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 2005 Forums
 Transact-SQL (2005)
 Cannot connect to SQL server 2005

Author  Topic 

ftpriolo
Starting Member

3 Posts

Posted - 2008-11-06 : 14:21:15
I'm trying to build an ASP page that will connect and pull data from a table(s) in an SQL server. The problem is I cannot windows or SQL authenticate for some reason. The error I get for the windows one says I just failed to login; the SQL one on the other-hand, says that I cannot connect to the database. I know the username and password are correct. I am running two separate servers for this (SQL one and ASP one). Another thing is, I can create a SharePoint webpart pulling this information. Anyone have any ideas?

Regards,

Franco

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-06 : 14:29:24
Could you paste your code here and also... what error message are you getting ?
Go to Top of Page

ftpriolo
Starting Member

3 Posts

Posted - 2008-11-06 : 14:38:01
All I did was click and drag the SQLDataSource option from the toolbox. Then I went to set it up. And i was getting those errors. Is there a better way of going about doing this.

Regards,

Franco
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-06 : 14:51:00
Thats not how its done.

Few questions.

1. Are you talking about classic ASP ? or .net ?
as you dont have the sqldatasource in ASP.

You have to setup a connection string and add your parameters etc
Go to Top of Page

ftpriolo
Starting Member

3 Posts

Posted - 2008-11-06 : 14:55:50
I apologize, I am using ASP.net. I read a book on ADO.net that was explaining how to set up this connection with sqldatasource. If setting up a connection string is how you do it, is it done in web.config?

Regards,

Franco
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-06 : 16:00:00
Next time its best to post your .net questions in the .net forum.

Anyway, the best way to set it up is to add a connection in the database panel, on the top right hand corner, next to the solutions panel and configure it, but if you want to do it manually its done by

<connectionStrings>
<add name="welcome" connectionString="Data Source=servername;Network Library=DBMSSOCN;Initial Catalog=databasename;User ID=username;Password=password" />

</connectionStrings>




One last advice, I hate the sqldatasource, its like a mouse trap in an old dark house. ( If your website is an enterprise application) Its far much better to use the object datasource

Go to Top of Page
   

- Advertisement -