0

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 ?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by prasanna201
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.