Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Satya
Posted

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

Satya
Posted

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

Satya
Posted

I not sure what is your problem, but you might try this connection string:

 

 

"PROVIDER=SQLOLEDB;DATA SOURCE=WIN2000\SQLANA;UID=sa;PWD=sa;DATABASE=pubs"

 

This is what I used usually and it never give me problem

Posted

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

Satya
  • Leaders
Posted

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 it'll run? That's always the first thing I try just isolate the problem.

--tim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...