Heple Posted February 20, 2006 Posted February 20, 2006 (edited) I want to link to a Microsoft Access database in visual studio. i am coding in C# and have found how to do using the site below http://www.geekpedia.com/prog_ttrls.php?id=158 i've got upto the section where you enter the page load event to fill in the data grid using the following VB Code private void Page_Load(object sender, System.EventArgs e) { Dim myReader As System.Data.OleDB.OleDBDataReader; OleDBConnection1.Open(); myReader= OleDbCommand1.ExecuteReader(); ISPDataGrid1.DataSource = myReader; ISPDataGrid1.DataBind(); } Can someone help me convert this to C# code as i am struggeling to perform this in C#. Thanks Craig Edited February 20, 2006 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted February 20, 2006 Administrators Posted February 20, 2006 private void Page_Load(object sender, System.EventArgs e) { System.Data.OleDB.OleDBDataReader myReader; OleDBConnection1.Open(); myReader= OleDbCommand1.ExecuteReader(); ISPDataGrid1.DataSource = myReader; ISPDataGrid1.DataBind(); } Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Heple Posted February 20, 2006 Author Posted February 20, 2006 private void Page_Load(object sender, System.EventArgs e) { System.Data.OleDB.OleDBDataReader myReader; OleDBConnection1.Open(); myReader= OleDbCommand1.ExecuteReader(); ISPDataGrid1.DataSource = myReader; ISPDataGrid1.DataBind(); } Cheers That worked fine and all compiled ok. But When i run it i get this error The Microsoft Jet database engine cannot open the file 'D:\Inetpub\wwwroot\bandwidthmonitor\ISPDatabase.mdb'. It is already opened exclusively by another user, or you need permission to view its data. Its not been opened by another program. I am the administrator i thought i would have permission. Do you know why it has thrown up this error. Craig Quote
*Experts* Nerseus Posted February 20, 2006 *Experts* Posted February 20, 2006 Make sure the file is not readonly and that it's not open in Access itself. Otherwise, I can't think of why you'd get that error. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.