connection string error??

anand

Well-known member
Joined
Jan 29, 2003
Messages
76
Location
chicago
Hi I am always getting some errors to connect to the sql server...pls give me a idea whats the correct syntax of connection string

i am getting the error

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user WIN2000\IUSR_WIN.
/anand/sqlcon.asp, line 11



i am using the connection string

con1.connectionstring="Provider=SQLOLEDB;Data Source=WIN2000\ANASQL;Initial Catalog=pubs;Integrated Security=SSPI"

pls give me a idea what mistake i did...


Thanks
Satya
 
Is "WIN2000\ANASQL" indeed your the server name?

Try using this instead (if its on your local machine)... 127.0.0.1
 
Hes using integrated windows authentication, not SQL Server authentication.
 
Hi I dont know which userid and password i have to use to access the database....bcz i am confused with both windows authendication and sql server authendication...pls give me a idea abt those ...and my windows login is user id:Administrator
password:sss ...so pls give me a idea how to write connection string now......

Thanks
Satya
 
Hi its ok now its not giving error in connection string its giving the
error in line set rs1=server.createobject("adodb.recordset")

i am writing the following code

<%
dim con1,cmd1,rs1
set con1=server.createobject("adodb.connection")
Dim constr1
constr1="Provider=sqloledb;Data Source=WIN2000\SQLANA;Initial Catalog=pubs;User Id=sa;Password=sa"
con1.open(constr1)
set rs1=server.createobject("ADODB.recordset")
rs1.open "select * from test",con1
reposne.write("connection opened")
%>

its giving the error invalid object :test
but i have table (test) in the pubs database..pls let me know whats my mistake...
Thanks
Satya
 
I not sure what is your problem, but you might try this connection string:


[VB]
"PROVIDER=SQLOLEDB;DATA SOURCE=WIN2000\SQLANA;UID=sa;PWD=sa;DATABASE=pubs"
[/VB]

This is what I used usually and it never give me problem
 
Hi
I gave that connecction string now its giving the error

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E37)
Invalid object name test1.
/anand/sqlcon.asp, line 15

rs1.open "select * from test1",con1


but there is a test1 table in my pubs database......pls tell me whats my mistake...
Thank you
Satya
 
Just out of curiousity, why are you using ADO stuff and not ADO.NET?

Can you cut and paste the query into QueryAnalyzer and see if itll run? Thats always the first thing I try just isolate the problem.
 
Back
Top