
January 17th, 2005, 04:06 AM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
ASP AND MYSQL PROBLEM Database Insert/update Problem
Please Help
I have an database in MYSQL, with the table of Users.
Here there these fields: ID (Int), Username (varchar), Password (varchar), City (varchar), COuntry (varchar), EMail (varchar), Accomplishments , Issues, Plans.
The last there are LONGTEXT Fields
This part of my ASP, takes information from a form which has the Accomplishments , Issues, Plans, looks at session ID, and goes to the specific persons record and add the accom., issues, and plans. No changes are made to the other fields.
Error is
Microsoft OLE DB Provider for ODBC Driverserror '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.7-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 /project/report_database.asp, line 41
Line 41: rsUpdateEntry.Open strSQL, adoCon
The code from the point where the form submit button is click goes to this ASP page:
Quote:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = Request.QueryString("ID") //ID from the QueryString is now IngRecordNO
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open ";Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=t;USER=p;PASSWOR D=l;OPTION=3;" //Connect to Database
'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblUsers.* FROM tblUsers WHERE ID=" & IngRecordNo //select everything from tblusers table where ID has been read
'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3
rsUpdateEntry.CursorLocation = 3
'Open the tblComments table using the SQL query held in the strSQL varaiable
rsUpdateEntry.Open strSQL, adoCon
if session("UserID") = rsUpdateEntry("User_passwd") Then //Use session to validate
'Update the record in the recordset
rsUpdateEntry.Fields("name") = Request.Form("Name")
rsUpdateEntry.Fields("accomplish") = Request.Form("Accomplish")
rsUpdateEntry.Fields("issue") = Request.Form("Issue")
rsUpdateEntry.Fields("plan") = Request.Form("Plan")
'Write the updated recordset to the database
rsUpdateEntry.update
Response.Redirect"main.asp?ID=" & reUpdateEntry("ID") & ""
'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing
Else
Response.Redirect "unauthorized.htm"
End If
%>
|
|