LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2009, 05:59 AM   #1
aeman
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Rep: Reputation: 0
mono SQL Server Connectivity Issue


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=adminsa;");

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=adminsa;");

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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN Connectivity Issue? your_shadow03 Linux - Newbie 7 04-22-2009 06:43 AM
Connectivity Issue rajaniyer123 Solaris / OpenSolaris 4 07-04-2007 11:29 AM
Mono issue with compilation drewbug01 Linux - Software 4 03-02-2007 06:04 PM
Migrating from MS-SQL server to My-SQL emailssent Linux - Networking 2 02-07-2005 03:20 PM
Mono sound issue with KDE stabile007 Slackware 5 07-28-2004 09:39 AM


All times are GMT -5. The time now is 04:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration