943,902 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2688
  • C# RSS
May 20th, 2009
0

How to remove uid and password in connection string?

Expand 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 ?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pradeepfusion is offline Offline
10 posts
since Apr 2009
May 21st, 2009
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
prasanna201 is offline Offline
2 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: opening Excel 2003 file by c#
Next Thread in C# Forum Timeline: C# program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC