PDA

Click to See Complete Forum and Search --> : Upating a database with ASP


Sep 28th, 2000, 12:44 PM
Hi there, I really would like some assitance in writing to my database.

Now here's my problem: I'm able to read from my database but when ever I attempt to update it I get an error message on my IE5 browser.

Here's the code that are working fine:

<%
set DBObj = server.createobject("ADODB.connection")
DBObj.open "TaskManager"
sqlquery = " SELECT Month, Day, Date FROM Selected_Month WHERE Month = 'October' "
set RSGetMonth = DBObj.execute(sqlquery)
DayOfWeek = RSGetMonth("Day")
DateOfWeek = RSGetMonth("Date")
DBObj.close
response.write "<p> Day of week =" &DayOfWeek& "</p>
response.write "Date of week = " &DateOfWeek
%>

The above reads the appropriate data from the database but when I try the following I get error messages:

<%set DBObj = server.createobject("ADODB.connection")
DBObj.open "TaskManager"
query = " UPDATE Calendar SET Date = 2 WHERE Day = 'Monday1' "
set RS = DBObj.execute(query)
DBObj.close
%>


I get error on the "set RS = DBObj.execute(query)" line
saying: Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] syntas error in UPDATE statement

If you could provide me with the initital few lines of codes to establish a connection in order to write to the database it will be very much appreciated.

monte96
Sep 28th, 2000, 07:16 PM
Your trying to assign a recordset to an action query that does not return a dataset.

An update statement will not return a dataset of the records that were updated.

Try this instead:


DBObj.execute query