Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2013
    Posts
    1

    Unanswered: Problem inserting a record into An Access Database via ASPX

    Having fits trying to insert a record. I've made a sample (see below), I can connect and query the table, but adding a record is giving me fits. first I got
    "Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype." So I tried every combination of cursortype and locktype but keep getting "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another." I must be doing something wrong. It's an Access 2007 database on a web server. I eliminated some of the connection string for security in the open below, but it does connect.
    <code>
    <%@ LANGUAGE = "VB" aspcompat = "true" %>

    <%
    Dim conn as object
    conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.ACE.OLEDB.12.0"
    conn.Open("wwwroot\App_Data\LooseGems.accdb")

    Dim rs as object
    Dim strSQL as String
    strSQL = "Select WorkID from Cart where ProductId=5005"
    rs=Server.CreateObject("ADODB.recordset")
    rs.ActiveConnection = conn
    rs.CursorType = adOpenStatic
    rs.LockType = adLockPessimistic
    rs.CursorLocation = adUseServer

    rs.Source = strSQL

    rs.Open()
    rs.AddNew
    rs.WorkID = "gobblygook" ' request("WorkID")
    rs.ProdID = "9999" ' request("ProductID")
    rs.Edate = "06/29/2013" 'request("Edate")
    rs.Price = 99.99 'request("Price")
    rs.PName = "Test Product" 'request("PName")
    rs.imagepath = "image/path" 'request("imagepath")
    rs.Weight = 12.3 'request("Weight")
    rs.Cut = "brilliant" 'request("Cut")
    rs.Color = "blue" ' request("Color")
    rs.Stone = "Topaz" ' request("Stone")
    rs.Update


    rs.Close
    rs = Nothing
    conn.Close
    conn = Nothing
    %>
    Last edited by JimPratt; 06-29-13 at 13:36. Reason: spelling

Tags for this Thread

Posting Permissions

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