Showing posts with label ltadd. Show all posts
Showing posts with label ltadd. Show all posts

Thursday, March 22, 2012

ConnectionString using SQL Server

Hello all,

I tried several connectionstrings in web.config file shown below and got this error "Application Error" (ErrorPage.htm).

<add name="ClubSiteDB" connectionString="Data Source=myClubs;Initial Catalog=Clubs;User Id=xxxx;Password=xxxx;" providerName="System.Data.SqlClient"/>
<add name="ClubSiteDB" connectionString="Driver={SQL Server};Server=localhost;Database=clubs;Uid=xxxx;Pwd=xxxx;" providerName="System.Data.SqlClient"/>

I created SQL Server 2000 database called clubs and ODBC DSN called myClubs at web hosting. It worked at local machine with no problem, but transfer from local machine to web hosting is something I'm not familiar with. Please advice. Thanks.

EagleGolf

check out www.connectionstrings.com|||

Hi!,

U have to specify the server name rather than 'localhost', if u r using trusted connection then it should be:
Database=Test;Server=Machine1;Trusted_Connection=Yes,
If not then specify the Userid and password:
server=Machine1;database=test;uid=xxx;pwd=xxx

Hope this will help
Regards

|||

The server name would be the url connected to the database. Or just the name like .\SQLEXPRESS? I use your method and it didn't work like it should.

|||

Hi,

Are u using SQL Express? If yes, then check this URL:

http://www.eggheadcafe.com/articles/20060719.asp

Hope this will help.

Regards

|||

I finally figured it out. I had the server name wrong and now it is corrected. Thanks for all of your help. Have a nice day.

Wednesday, March 7, 2012

connection to database ?

can i have multiple user and password in a connection string ??

for example :

<add name="strCon" connectionString="Data Source=test;Initial Catalog=test;User=test, guest;Password=test, guest" providerName="System.Data.SqlClient" />-

or is there any other way ??

the reason is that i have created a view that hits 2 database that requires user info and pass ...........any advice is appreciated

Just put two connection strings in your web.config and in the area that says add name="" give them separate names. In your datalayer you will have to allow for this. When it is calling from one database call the appropriate connection string. When it is the other use the second connection string.

I hope that this helps.|||thanks for the info...........