Simple Data Entry In Microsoft Access Database

by Shabbir on May 1, 2008

in C#

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)

Data entry

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

Data entry table

Sharing is Caring...

Other Related Posts:

  1. Creating a Database Connection
  2. ASP.Net Database Connection
  3. Adding Items to ListView Control
  4. Read/Write Registry Keys
  5. Read From File Using StreamReader Class

{ 1 comment… read it below or add one }

Data Entry December 24, 2010 at 10:13 am

Is there is any use of outsourcing in data entry company?

Reply

Leave a Comment

Spam protection by WP Captcha-Free

{ 1 trackback }

Previous post:

Next post:

    About the Author

  • author photo

    My Name is Shabbir Bhimani and I am developer by profession in the field of applications, web and database. Currently doing full time online marketing and like to share my experiences on how you can make money online @ CodeItWell.com. Read more ...


    See how you can get in touch with me.