abhishek tiwari

abhishek tiwari

  • NA
  • 3
  • 3.2k

My connection string is giving unhandeled exception

Mar 27 2011 5:09 AM
Hi,

I want to display data from MS Access into gridview control.
but i am getting unhandeled exception in connection string that is 'Data Source=C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\shreedharmanagementsystem\shreedharmanagementsystem\App_Data\my.accdb' is not a valid virtual path.
Code is given below .

string connection = "Data Source=C:\\Documents and Settings\\Administrator\\My Documents\\my.accdb";
string query= "Select * from fee where status=Pending ";
AccessDataSource ads = new AccessDataSource(connection,query);
 GridView1.DataSource = ads;
GridView1.DataSourceID = String.Empty;
 GridView1.DataBind();

Pls help me out

Thanks&Regards
Abhishek

Answers (6)