Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    2

    Unanswered: How to add record into SQL Server 2000?

    How can I add the record into my company SQL Server 2000 database from the website register page???

    This is my codes:
    <%
    Dim sql,rs

    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\InetPub\wwwroot\daly\fpdb\market.mdb"

    sql="INSERT INTO testing (fname,lname)"
    sql=sql & " VALUES "
    sql=sql & "('Shawn', 'mike')"

    objConn.Execute sql
    objConn.close
    %>

    This is my error:
    Microsoft JET Database Engine error '80004005'

    Operation must use an updateable query.

    /VITA_SHOW/test_VITAFormhandler.asp, line 137


    Thank you very much!!!

    Shawn
    scn@daly.com

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Not sure why you are getting that error, but a much better design strategy is to create a stored procedure that inserts the record based upon supplied parameters. You should avoid giving applications direct access to data tables.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Aug 2004
    Posts
    7
    your problem might have been either...

    1. you dont have the NT permissions for a file-based database or for the folder that contains the file
    2. the file might have been exclusive
    3. theres another thats still connected that needs to be closed

    for more info on issuing this problem, goto MS white papers

    http://support.microsoft.com/default...b;EN-US;306269

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    What type of object is "testing"? I suspect it's not a table, but rather a query.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Aug 2004
    Posts
    11
    You say that you are updating SQL Server 2000, but your code seems to be looking at a Microsoft Access database - the Jet engine and the .mdb extension both refer to Access.

    Andy

  6. #6
    Join Date
    Aug 2004
    Posts
    5
    Quote Originally Posted by saleng
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=c:\InetPub\wwwroot\daly\fpdb\market.mdb"
    First off, the database is Access, not SQL, as can be seen from the connection string above.

    If you are trying to use access, then the reason for the error is that the IUSR_SERVERNAME (or the authenticated web user, if applicable) does not have write access to the folder and file at c:\InetPub\wwwroot\daly\fpdb\market.mdb. Make sure you set read/write privileges for IUSR_SERVERNAME or Everyone for both the MDB file and the folder in which it resides.

    If you are in fact trying to connect to an MSSQL server, you will need to do one of the following:

    a) If you have access to the ODBC configuration, set up a DSN, and use the following syntax:

    objConn.Open "DSNNAME","USERNAME","PASSWORD"

    b) If you don't have access to create a DSN, use the following syntax:

    objConn.Open "Driver={SQL Server};UID=USERNAME;password=PASSWORD;database=DATABASE_NAME;server=SERVER_NAME_OR_IP"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •