In the previous post. We described the connection to the Microsoft Access database.
Now we will add some functionality to that. The user can insert diferent records.
For start, make a form like this (the names of the components are specified on the picture)

Now in the button1 event method insert this code
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;"; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = connStr; string cmdStr = "INSERT INTO Info (FirstName, LastName)" + " VALUES('"+textBox1.Text+"', '"+textBox2.Text+"');"; OleDbCommand cmd = new OleDbCommand(cmdStr, conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close();
The code is the same from the previous post with only one difference, the string cmdStr is changed. Now the command in the table columns will insert the data which is written in the text boxes.
Now the table will have different records









{ 1 comment… read it below or add one }
Is there is any use of outsourcing in data entry company?
{ 1 trackback }