Thursday, September 18, 2008

Database connectivity using MS-ACCESS having C# as the Programming language.


The Code Goes Like This :


String constring ="Provider = Microsoft.Jet.OLEDB.4.0;Data Source = C:Database1.mdb";

//Making connecting to MS-ACCESS WITH A CONNECTION STRING OF YOUR DATA BASE

OleDbConnection mycon = new OleDbConnection(constring);

//OPEN METHOD ESTABLISH THE CONNECTION.

mycon.Open();

//Query to retrieve the result for the connection that has opened

String query = "select * FROM Table1";

OleDbCommand cmd = new OleDbCommand ( query,mycon);



No comments: