anand Posted February 25, 2003 Posted February 25, 2003 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 Quote Satya
Moderators Robby Posted February 26, 2003 Moderators Posted February 26, 2003 Is "WIN2000\ANASQL" indeed your the server name? Try using this instead (if it's on your local machine)... 127.0.0.1 Quote Visit...Bassic Software
bungpeng Posted February 26, 2003 Posted February 26, 2003 Where is your username and password to access database? Quote
*Gurus* divil Posted February 26, 2003 *Gurus* Posted February 26, 2003 He's using integrated windows authentication, not SQL Server authentication. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
bungpeng Posted February 26, 2003 Posted February 26, 2003 you mean it use the client login to access database? Quote
anand Posted February 26, 2003 Author Posted February 26, 2003 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 Quote Satya
anand Posted February 26, 2003 Author Posted February 26, 2003 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 Quote Satya
bungpeng Posted February 27, 2003 Posted February 27, 2003 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 Quote
anand Posted February 27, 2003 Author Posted February 27, 2003 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 Quote Satya
Leaders quwiltw Posted February 27, 2003 Leaders Posted February 27, 2003 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. Quote --tim
bungpeng Posted February 28, 2003 Posted February 28, 2003 Try to use other table see whether the same problem? QueryAnalyzer to test first is a good choice. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.