[MonoDevelop] mono SQL Server2005 connectivity issue

Aemz amna.abbasi at eitsec.co.uk
Tue Oct 13 07:19:02 EDT 2009


Hi,

I try to run a C# code on CentOS5 using mono version is 1.2.4. I compile my
code by issuing command on terminal
#gmcs Program.exe -r:System.Data

the code compile successfully.

when i run my code by issuing command on terminal
#mono Program.exe

OUTPUT is:
Wowww

Unhandled Exception: System.Data.SqlClient.SqlException: SQL Server does not
exist or access denied
at Syatem.Data.SqlClient.SqlConnection.Open () [0x0000]
at Sqlprob.Program.Main(System.String[] args) [0x0000]

My code is:
using System;
//using System.Collections.Generic;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;

namespace sqlprob
{
class Program
{
static void Main(string[] args)
{

SqlConnection myConnection = new SqlConnection(@"Data
Source=ITSECWIN3KSRV09\SQLEXPRESS; Initial
Catalog=EMS_Enquirer_Logoinn_Phase2_Dev; User ID=sa; Pwd=admin;");

myConnection.Open();
try
{

if (myConnection.State.ToString() == "Open")
{

Console.WriteLine("Wowww");
Console.ReadLine();
}
else
{
Console.WriteLine("Hooooowwww");
Console.ReadLine();
}

}//end try
catch(Exception ex) {
Console.WriteLine(ex.Message + ex.Source);
}
SqlConnection mycon = new SqlConnection(@"Data
Source=ITSECWIN3KSRV09\SQLEXPRESS; Initial
Catalog=EMS_Enquirer_Logoinn_Phase2_Dev; User ID=sa; Pwd=admin;");

mycon.Open();
try
{
Console.WriteLine(mycon.State.ToString());
}
catch(Exception ex)
{
Console.WriteLine(ex.Message+ex.Source);

}
}
}

}

Please help me out. I am totally stuck in my application.

Thanks in advance...
-- 
View this message in context: http://www.nabble.com/mono-SQL-Server2005-connectivity-issue-tp25871052p25871052.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.



More information about the Monodevelop-list mailing list