meltingpot
Technical User
Ive used this code lots but this particular time its got the better of me.
Im updating a field in a table called 'CStatusCode'. Its a text field in Access 2003.Ive cheked that the the data type is right. I get the following page errors
1)
when the "CourseID" has numbers only -
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
2)
when the "CourseID" has numbers and text -
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CourseID = 5035a'
Code:
Head:
<% If Request.QueryString("update") <> "" Then %>
<%
strConnectionString = "dsn=jsastc"
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.Open strConnectionString
strSQL = "UPDATE Courselist SET Courselist.CStatusCode = '"&(Request.QueryString("update"))&"' WHERE CourseID = "&(Request.QueryString("CourseID"))&""
cnn.Execute strSQL,,adCmdText + adExecuteNoRecords
cnn.Close
%>
<% Else %>
<% End If %>
In Body ...............................
<a href="close_off_course.asp?CourseID=<%=(courselist.Fields.Item("CourseID").Value)%>&update=Finished"><img src="../images/button_fail.gif" width="25" height="20" border="0"></a>
end ----------------------------
I must be making a very basic mistake or ??????
Please help - its driving me MAD !!!!!
Im updating a field in a table called 'CStatusCode'. Its a text field in Access 2003.Ive cheked that the the data type is right. I get the following page errors
1)
when the "CourseID" has numbers only -
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
2)
when the "CourseID" has numbers and text -
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CourseID = 5035a'
Code:
Head:
<% If Request.QueryString("update") <> "" Then %>
<%
strConnectionString = "dsn=jsastc"
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.Open strConnectionString
strSQL = "UPDATE Courselist SET Courselist.CStatusCode = '"&(Request.QueryString("update"))&"' WHERE CourseID = "&(Request.QueryString("CourseID"))&""
cnn.Execute strSQL,,adCmdText + adExecuteNoRecords
cnn.Close
%>
<% Else %>
<% End If %>
In Body ...............................
<a href="close_off_course.asp?CourseID=<%=(courselist.Fields.Item("CourseID").Value)%>&update=Finished"><img src="../images/button_fail.gif" width="25" height="20" border="0"></a>
end ----------------------------
I must be making a very basic mistake or ??????
Please help - its driving me MAD !!!!!