Sarah Mandana
Sarah Mandana

Reputation: 1513

Replacing ODBC MySQL string to SQL Server String in C#

I have an ODBC Connection string in MySQL in C#:

conn.ConnectionString = "DSN=TrAudit_SQL;Uid=userid;Pwd=password;";

I have changed my database from My SQL to SQL Server and now I only want to change the connection string, not the rest of the code. I have searched for odbc connection string in SQL Server but I have not been successful. Is there any solution to it that I just change this string and my code further could just remain same.

Upvotes: 0

Views: 93

Answers (1)

Akshey Bhat
Akshey Bhat

Reputation: 8545

conn.ConnectionString = "Driver={SQL Server Native Client 10.0};Server=myServerAddress;
Database=myDataBase;Uid=myUsername;Pwd=myPassword";

Try this.

Upvotes: 1

Related Questions