Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset creation problem

Status
Not open for further replies.

ants211

Technical User
Feb 22, 2002
15
GB
Hi, This code works when I am querying an Access database. However, I have recently created a database on an SQL 2000 Server. The DSN works and i can connect to the database, but I can't draw a recordset from it. This is the code:

<%

Dim conn, rs
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;DSN=helpdeskdb&quot;
set rs=Server.CreateObject(&quot;ADODB.recordset&quot;)
rs.Open &quot;Select * from user&quot;, conn

%>

The error I get is a 500.100 which says -

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'user'.
/test.asp, line 7

I reckon this is probably an easy one to solve. Any help would be appreciated.
 
Try renaming your table to &quot;tblUser&quot; or &quot;aUser&quot; or anything but User. It's possible itjust doesn't like that word.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
first assumption I would come up with is user is a restricted would. as in the connection string for most databases use user=;password=;

try changing the name of the table ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
your even faster at clicking [lol] ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Thanks a lot guys! That worked a treat. I had a feeling it was a stupid mistake....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top