CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Help sql insert

  1. #1
    Join Date
    Mar 2002
    Posts
    4

    Help sql insert

    I am trying to insert into a table in my Acess database through a form in my asp page... ive got the code right but when I run it I get the following error message

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.

    /nemendur/thormundurh/default.asp, line 46

    this is my connection and sql line :

    dim rsRU
    Dim cnRU, sConnString
    Set cnRU= Server.CreateObject("ADODB.Connection")
    sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("\nemendur\thormundurh\db\tolvunord.mdb") & ";"
    cnRU.Mode = 3 '3 = adModeReadWrite
    cnRU.Open(sConnString)

    cnRU.Execute("INSERT INTO Umraedan values(1, '" &nafn & "', '" &email & "', '" &homesite & "', '" &text & "')")

    please help...



  2. #2
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    56

    Re: Help sql insert

    I came across something strange like that before, two things you can try.

    1. cnRU.Mode = 3 '3 = adModeRead & adModeWrite
    2.

    Dim cnn as ADODB.Connection
    Dim strConnect as string
    Dim strSQL as string

    Const conFilePath as string = Server.MapPath("\nemendur\thormundurh\db\tolvunord.mdb")
    ' Format connection string.
    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & conFilePath

    ' Open Connection object.
    set cnn = new ADODB.Connection
    cnn.Open strConnect

    ' Format SQL statement to update records.
    strSQL = ("INSERT INTO Umraedan values(1, '" &nafn & "', '" &email & "', '" &homesite & "', '" &text & "')")
    ' Begin transaction.
    cnn.BeginTrans

    ' Execute SQL statement.
    cnn.Execute strSQL






    Andy

    Don't forget to rate!!!

    Andrew Lennon (Berlitz)
    Automation Dev Engineer

  3. #3
    Join Date
    Mar 2002
    Posts
    4

    Re: Help sql insert

    Thank you,

    I had allready tryed your advice no. 1 and
    the seccond one did not work either, I allways get
    the same error... Do you know any website or something that tackles ASP and SQL ??? But I kinda think this is a problem with the database itself... it´s like I do not have the propper authoritie to write to it... even though it is only a simple access database


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured