How to remove uid and password in connection string?

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Apr 2009
Posts: 10
Reputation: pradeepfusion is an unknown quantity at this point 
Solved Threads: 0
pradeepfusion pradeepfusion is offline Offline
Newbie Poster

How to remove uid and password in connection string?

 
0
  #1
May 20th, 2009
Hi,
When I use sql server native client for odbc sql connection then it is asking uid and password, once I supply uid and pwd in odbc connection , I think there should not be necessary to give uid and password in C# in sql connection string. I want once we supply the dsn value to odbc sql connection string then it should not ask for uid and password which is already given in dsn creation. How can I resolve it ?
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 2
Reputation: prasanna201 is an unknown quantity at this point 
Solved Threads: 0
prasanna201 prasanna201 is offline Offline
Newbie Poster

Re: How to remove uid and password in connection string?

 
0
  #2
May 21st, 2009
Originally Posted by pradeepfusion View Post
Hi,
When I use sql server native client for odbc sql connection then it is asking uid and password, once I supply uid and pwd in odbc connection , I think there should not be necessary to give uid and password in C# in sql connection string. I want once we supply the dsn value to odbc sql connection string then it should not ask for uid and password which is already given in dsn creation. How can I resolve it ?
Hi,

Declare the connection string in web.config.

like below,
<configuration>
<appsettings>
<add key="Connectionstring" value="data source=ServerName;initial catalog=dbname;uid=username of sql server;pwd=password of the sql server">
</add>
</appsettings>
</configuration>

or declare the connection string in form level

public sqlconnection con=new sqlconnection (="data source=ServerName;initial catalog=dbname;uid=username of sql server;pwd=password of the sql server");

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC