VB/ASP and databases

Discussion in 'Software' started by Madmaxtothemax, Dec 5, 2009.

  1. Madmaxtothemax

    Madmaxtothemax Private E-2

    Guys I have been trying to get this to work for the past 30 hours, it's probably something simple but please have a look because I cannot fot the life of me get this to work.


    set conn = Server.CreateObject("ADODB.Connection")
    'name of database
    conn.Open "databasename"
    'accounts is the name of the table
    sql = "SELECT * FROM accounts"
    Set rsadd = Server.CreateObject("ADODB.RecordSet")
    'adlock is correct
    rsadd.Open sql, conn, adLockOptimistic, adCmdTable
    'set the recordset space to write a new record
    rsadd.Addnew
    'assign the text boxes to Recordset fields
    rsadd("userid") = form.request("Account")
    rsadd("Password") = form.Request("Password")
    rsadd("Fname") = Request("firstname")
    rsadd("Lname") = request("lastname")
    rsadd("Departid") = request("Department")

    'write back to database
    rsadd.Update
    'move the record pointer to the first record
    rsadd.MoveFirst
    'close the recordset
    rsadd.close
    set rsadd = nothing
    conn.close
    set conn = nothing
    Response.write "New account added"




    I keep getting the Error:
    Error Type:
    ADODB.Recordset (0x800A0CB3)
    Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.

    on line :
    rsadd.Open sql, conn, adLockOptimistic, adCmdTable


    Please, one of you must have some Idea what is going on here. I have tried every different syntax I can think of but it just will not work.
     
  2. Wyatt_Earp

    Wyatt_Earp MajorGeek

  3. Madmaxtothemax

    Madmaxtothemax Private E-2

    I did, multible times, thats why I turned to a fourm. I eventually did figure it out at 2 oclock this morning, there was an error in the permissions of my database.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds