[Mono-dev] Strange MSSQL provider behavior

Andrew Koryavchenko avk at rsdn.ru
Fri Mar 21 10:10:33 EDT 2008


Part of the code:

const string connStr =
    @"User ID=Tornado;Pwd=******;Net=dbmssocn;Server=127.0.0.1\DEV;Integrated
Security=no;Initial Catalog=LocalDB";
const string cmdText = "SELECT COUNT(*) FROM units";
using (var con = new SqlConnection(connStr))
using (var cmd = new SqlCommand(cmdText, con))
{
    con.Open();
    Console.WriteLine(cmd.ExecuteScalar());
}

Console.WriteLine("BeforeCheckDeploy");
// Deploy
if (cmdLine.IsExists(s_DeployKey))
{
    Console.WriteLine("BeforeDeploy");
    TornadoRunner.Deploy();
    if (!cmdLine.IsExists(s_RunInConsoleKey))
        return 0;
}
Console.WriteLine("AfterCheckDeploy");

using (var con = new SqlConnection(connStr))
using (var cmd = new SqlCommand(cmdText, con))
{
    con.Open();
    Console.WriteLine(cmd.ExecuteScalar());
}

Output:
0
BeforeCheckDeploy
AfterCheckDeploy
ERROR: System.Data.SqlClient.SqlException: SQL Server does not exist
or access denied.
  at System.Data.SqlClient.SqlConnection.Open () [0x00000]
  at Parus.Server.Program.Main () [0x00000]

Test sample running OK.

Any ideas?

P.S. Vista, SQL Server 2005 SP2, Mono 1.9 last preview

-- 
With best regards,
  Andrew Koryavchenko, Visual C# MVP [Architecture].


More information about the Mono-devel-list mailing list