challengeAccepted
challengeAccepted

Reputation: 7590

Data source for connection string in Web.config

I was wondering what should be the data source for the connection string in Web.config

My SQL Database explorer looks like 198.57.59.70(SQL Server 10.50.1600 - RAM\ServerAdmin) under which i have databases. When i use this, i get as Network to the database does not exists. When i use Data Source=198.57.59.70, i get an error "System.Data.SqlClient.SqlException: Login failed for user 'RAM\IWPD_3" This is in asp.net 3.5 in Windows server 2008 for deployment. Thank you!

Can some one guide me, Thank you!!

<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=198.57.59.70(SQL Server 10.50.1600 - COMM\ServerAdmin);Initial Catalog=Tracking;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>

Upvotes: 2

Views: 21438

Answers (2)

meda
meda

Reputation: 45490

For me Connection strings could be hard to remember. Its very easy to make a mistake when you write it manually. One advice is to use the server explorer to connect to your database. Then right click on your database icon > select properties ... you will see the connection string copy and paste . Voilà!

If you still have problem then remove the integrated security setting

Server Explorer:

enter image description here

Properties:

enter image description here

Upvotes: 6

cygnim
cygnim

Reputation: 2035

For SQL if you're using integrated security, your connection string data source should just be the computer name (or IP address) or the computer name IP\instance name if you're running named servers. You shouldn't need "(SQL Server 10.50.1600 - COMM\ServerAdmin)" in the data source.

Also, make life a little easier and don't name it "ConnectionString," as this is redundant. Instead, describe the resource you're connecting to. Assuming the IP is correct and your server is allowing remote connections, your connection string should look something like this:

<add name="TrackingDataStore" connectionString="Data Source=198.57.59.70;Initial Catalog=Tracking;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>

Upvotes: 0

Related Questions