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
 Development Tools
 ASP.NET
 sql server coonection

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-08 : 07:48:26
seshu writes "hi
iam trying to sql server open connection using asp.net
here is the code


@ Import Namespace="System.Data.SqlClient"

<script runat="server">
Sub Page_Load

Dim conPubs As SqlConnection

conPubs = New SqlConnection ("Server=localhost;uid=sa;pwd=;database=pubs")

conPubs.Open()

End Sub




iam getting this error
System.Data.SqlClient.SqlException: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection"

chadmat
The Chadinator

1974 Posts

Posted - 2005-03-08 : 13:58:25
Your SQL Server is probably installed with Windows trusted authentication. You need to change it to mixed. Right click the server in EM, and select properties, select the security tab. Make sure SQL and Windows is selected.

You should also add a password for sa.

-Chad

http://www.phxpoker.com

Phoenix's largest online poker community
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-03-08 : 23:51:56
You shouldn't use sa either.
You should also make use of the web.config file and store your connection string information here.
That way you do not have to repeat that same string over and over.


for(int i = 0; i < sizeof(infinity); i++)
cout << "Corporate accounts payable, this is nina speaking, just a mommmmmmmment!";





Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -