[Mono-dev] Problems connecting to MS SQL with C# and Mono

Joe Audette joe_audette at yahoo.com
Mon May 22 12:40:38 EDT 2006


Hi,


>I get a horrible exception when attempting to connect to an MS SQL Express
server from Mono (it works under the MS CLR).  

Here is the code I use to make the connection:

string ConnectionString = "Data Source=127.0.0.1\SQLEXPRESS;
Database=mydatabase;User ID=user;Password=password";

SqlConnection DatabaseConnection = new SqlConnection(ConnectionString);
DatabaseConnection.Open(); //Exception thrown here
<

2 things jump out at me.
1. Your connection string has 127.0.0.1 which when running on the mono machine would point to the mono machine so unless you are running mono on windows that could be part of the problem.
2. Your connection string is apparently using integrated windows security since it has no user name and password. This probably won't work if the mono machine is a linux machine.

Hope it helps,

Joe







More information about the Mono-devel-list mailing list