Problem with Connection ?
-
I am loading data from Access table into GridView, but it shows nothing in my Web Application after executing. What is wrong int this code?Plz help. This is my connection code. private void Binding() { // create the connection OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:/GmoteDeviceControl/App_Data/DeviceCtrl.mdb;User Id=admin;Password=;"); // Open the connection con.Open(); // create the DataSet DataSet ds = new DataSet(); // create the adapter and fill the DataSet OleDbDataAdapter da = new OleDbDataAdapter("Select * from SUBSCRIBER_DEVICES", con); da.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); // close the connection con.Close(); }
-
I am loading data from Access table into GridView, but it shows nothing in my Web Application after executing. What is wrong int this code?Plz help. This is my connection code. private void Binding() { // create the connection OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:/GmoteDeviceControl/App_Data/DeviceCtrl.mdb;User Id=admin;Password=;"); // Open the connection con.Open(); // create the DataSet DataSet ds = new DataSet(); // create the adapter and fill the DataSet OleDbDataAdapter da = new OleDbDataAdapter("Select * from SUBSCRIBER_DEVICES", con); da.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); // close the connection con.Close(); }
Put a breakpoint to the line
Purish Dwivedi wrote:
da.Fill(ds);
and see if
ds.Tables[0]
is filled with data properly or not.Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml>