Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select issue
Message
From
24/02/2003 17:22:55
Fabian Belo
Independent Developer
Argentina
 
General information
Forum:
ASP.NET
Category:
Other
Title:
SQL Select issue
Miscellaneous
Thread ID:
00757278
Message ID:
00757278
Views:
46
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.
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Next
Reply
Map
View

Click here to load this message in the networking platform