First use System.Data.OleDb name space. Write the following code
in button click event.
string myConnectionString="";
myConnectionString = "Provider =Microsoft.Jet.OLEDB.4.0; Data Source=D:\\person.mdb";
OleDbConnection myConnection = new OleDbConnection (myConnectionString);
string myInsertQuery="INSERT INTO emp Values('"+ textBox1.Text "')";
OleDbCommand myCommand =new OleDbCommand (myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open ();
try
{
myCommand.ExecuteNonQuery ();
MessageBox.Show("records are successfully insert");
}
catch(Exception ex)
{
MessageBox.Show (ex.Message.ToString ());
}
myConnection.Close ();
Kindly Note that here i assume that we have created person.mdb file in D drive & there is a emp table in this file.
hi
i need to store the value which i entered in a textbox to the MS ACCESS file(ie . .mdb file).. and hw can i retrive the data from MS ACCESS....