SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 393.9k

How to find connection status ? in DATASET

Sep 18 2013 5:34 AM
Hi

Well all know dataSet works in disconnected architecture . So internally it opens connection & closes right .. so i want to know when it will open & close connection i tried like below ??

OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\users\\sunil\\my documents\\empdatabase.accdb;Persist Security Info=False");
OleDbDataAdapter da = new OleDbDataAdapter("Select * from customer ", con);
            DataSet ds = new DataSet();
            da.Fill(ds,"sunil");
            dataGridView1.DataSource = ds.Tables[0];

I kept messagebox.show(con.state.Tostring()); one every line to know when it is open but i am getting always its is closed .. 

Any suggestions 

Cheers & thanks 

Answers (3)