Why compiler go to suspend mode when want to open database?
- by rima
Dear friend
I try to connect to database with a less line for my connection string... I find out s.th in oracle website but i dont know Why when the compiler arrive to the line of open database do nothing????!it go back to GUI,but it like hanging...please help me to solve it.
p.s.Its funny the program didnt get me any exception also!
these service is active in my computer:
> Oracle ORCL VSS Writer Service Start
> OracleDBConsolrorcl
> OracleJobSchedulerORCL Start
> OracleOraDB11g+home1TNSListener Start
> oracleServiceORCL Start
try
{
/**
*
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rima-PC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)*/
string oradb = "Data Source=(DESCRIPTION="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rima-PC)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));"
+ "User Id=bird_artus;Password=123456;";
//string oradb = "Data Source=OraDb;User Id=scott;Password=tiger;";
string oradb1 = "Data Source=ORCL;User Id=scott;Password=tiger;"; // C#
OracleConnection con = new OracleConnection();
con.ConnectionString = oradb1;
String command = "select dname from dept where deptno = 10";
MessageBox.Show(command);
OracleDataAdapter oda = new OracleDataAdapter();
oda.SelectCommand = new OracleCommand();
oda.SelectCommand.Connection = con;
oda.SelectCommand.CommandText = command;
con.Open();
oda.SelectCommand.ExecuteNonQuery();
DataSet ds = new DataSet();
oda.Fill(ds);
Console.WriteLine(ds.GetXml());
dataGridView1.DataSource = ds;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString()+Environment.NewLine+ ex.StackTrace.ToString());
}