Squall Leonhart
12-22-2003, 08:43 PM
Hi, guys.
I want to add the items to the access database.
I run the site on IIS in XP pro.
I have written the following code. Please have a look.
update.asp
code:--------------------------------------------------------------------------------
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
adoCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("game.mdb")
Select Case Request.Querystring("state")
Case "add"
strSQL = "SELECT * FROM tblGame;"
rsAddComments.CursorType = 2
rsAddComments.LockType = 3
rsAddComments.Open strSQL, adoCon
rsAddComments.AddNew
rsAddComments.Fields("title") = Request.Form("title")
rsAddComments.Fields("genre") = Request.Form("genre")
rsAddComments.Fields("Content") = Request.Form("content")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
Response.Redirect "post.asp"
End select
%>
--------------------------------------------------------------------------------
When the this page loads, error message
'Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.'
appears. Do you guys know what would cause this kind of error?
Thanks.
I want to add the items to the access database.
I run the site on IIS in XP pro.
I have written the following code. Please have a look.
update.asp
code:--------------------------------------------------------------------------------
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
adoCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("game.mdb")
Select Case Request.Querystring("state")
Case "add"
strSQL = "SELECT * FROM tblGame;"
rsAddComments.CursorType = 2
rsAddComments.LockType = 3
rsAddComments.Open strSQL, adoCon
rsAddComments.AddNew
rsAddComments.Fields("title") = Request.Form("title")
rsAddComments.Fields("genre") = Request.Form("genre")
rsAddComments.Fields("Content") = Request.Form("content")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
Response.Redirect "post.asp"
End select
%>
--------------------------------------------------------------------------------
When the this page loads, error message
'Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.'
appears. Do you guys know what would cause this kind of error?
Thanks.