Nadya:
objRS.Open strSQL, objConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
<PRE>
Change above line to
<PRE>
objRS.Open strSQL, objConnection, adOpenForwardOnly, adLockReadOnly, adCmdText
HTH
Suggestion: IMHO, lock syntax here isn't necessary, SQL manages locks on it's own fine.
This is the code, I'm trying to use for displaying data with navigation:
set objRS = server.CreateObject("ADODB.Recordset")
objRS.PageSize = 6
objRS.CacheSize = 300
objRS.CursorLocation = adUseClient
dim SearchString
searchstring = ""
strSQL = ""
icount = ""
'take all the form details and store them in the variables
'searchstring = Request.querystring("txtsearch")
strSQL = "select CredID, CreditCat, ccode, town, Address from " & _
"CreditInfo where town in ('MLFD','COLC','OLYM') order by CreditCat, Address"
'strSQL = "SELECT * FROM table WHERE fieldname='" & searchstring & "'"
objRS.Open strSQL, objConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
It gives me Microsoft OLE DB Provider for ODBC Drivers (0x80040E37)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'select'.
/nadyatest/DataWithNavigation.asp, line 38
However, this code works fine:
strSQL = "select CredID, CreditCat, ccode, town, Address from CreditInfo where town in ('MLFD','COLC','OLYM') order by CreditCat, Address"
set oRS = DBObj.Execute(SQL)
Could somebody please explain my error?
Thanks in advance.