Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Difference in Open vs. Execute for Recordset
Message
De
05/03/2003 19:02:25
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00757092
Message ID:
00761883
Vues:
20
Hi Nadya,

From a newbie point of view, I am wondering where you define objConnection... and if your ADO is already set on a connection, would
objRS.Open strSQL, , adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
work instead?


Ric

>Hi everybody,
>
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform