var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help!! Can't UPDATE Access DB using Ado!
I'm new at ADO and I'm trying to learn about it. I solved some problems already but I really don't know what to do about this one.
This is the problem. I've created a simple asp page with this code:
<!-- #INCLUDE file="functions.inc" -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<% AddProd %>
And the function:
<% Sub AddProd()
' Get link info
CatID = Request.QueryString()
dim Prod_Name, Prod_weigth, Prod_Units, Prod_Unit_Pr
Prod_Name = Request.Form("prod_name")
Prod_weigth = Request.Form("prod_weigth")
Prod_Units = Request.Form("prod_units")
Prod_Unit_Pr = Request.Form("prod_unit_pr")
' Setting ADO Connection
set adoConn = server.createobject("adodb.connection")
adoConn.Mode = adModeReadWrite
' Setting AddRs Recordset
set AddRs = server.createobject("adodb.recordset")
addRs.open "Products", adoConn, adOpenStatic, adLockPessimistic
addRs("Product Name") = Prod_Name
addRs("Product Weigth") = Prod_Weigth
addRs("Product Name") = Prod_Units
addRs("Product Name") = Prod_Unit_Pr
set addRs = nothing
set adoConn = nothing
My browser returns the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][Controlador Microsoft Access de ODBC] Update not possible. Database or object read-only.
(translated from Portuguese)
I'm running windows XP SP1 and IIS 5.1 and I created a DSN to my DB.
What can I do to solve this problem?
Hope someone can help me.
Thank you @all very much,
You may change adOpenStatic to adOpenDynamic.
unfortunetly that didn't solve the problem...
But thaks anyway,
Did you try to insert data into a table on Query Analyzer?
Err,... it's an Access Database, not a MS SQL database.
Did you try inserting the data directly into the table via Access? It could be that the file is marked as read only.
I'me new at ASP/ADO but I'm sure that Access db is working fine...the problem happens when I try to update it's records from a ASP page using ADO...
But thanks anyway,
In your code
what is "connSrc"?
The code should be
Which one do you use to access your database?
SQL server authentication or Windows NT authentication?
Thank you @ll folks!
I managed to solve the problem on my own.
By the way what I've done was to change my connSrc to DSN-Less connection.
I saw somewhere that OBDC is obsolete so I changed to something like this:
connSrc = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=somesource;"
using OLEDB instead.
This bringed me some other problems that I've managed to solve using Microsoft Knowledge base and configuring permissions on XP and IIS 5.1.