Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 select statement error using MSDE

Author  Topic 

isheikh
Starting Member

25 Posts

Posted - 2004-02-14 : 11:14:04
Hi,

I am using MSDE. When I have the following code it works fine.


Dim objConn, objRS
Set objConn=Server.CreateObject("ADODB.Connection")
Set objRS = server.CreateObject("ADODB.Recordset")


objConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=AStrongSAPwd;Initial Catalog=bothamSQL;Data Source=irfan-ne8ldmk8y;Initial File Name=D:\Program Files\Microsoft SQL Server\MSSQL\Data\bothamSQL.mdf"



objRS.Open "table1",objConn,adOpenForwardOnly,adLockReadOnly,adCmdTable

While not objRS.EOF
response.write objRS("id").Value & "<br>"
objRS.MoveNext
Wend

But when I put select statement instead of only table name at objRS.open, like,

objRS.Open "select * from table1",objConn,adOpenForwardOnly,adLockReadOnly,adCmdTable

I get this error

Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Incorrect syntax near the keyword 'select'.


I was told you can put the select statement there, anyone know s why I am geting this error














   

- Advertisement -