Skip to content

Instantly share code, notes, and snippets.

@harshityadav95
Created July 30, 2016 11:39
Show Gist options
  • Save harshityadav95/ef2706f91b0331213588f23b00e19a16 to your computer and use it in GitHub Desktop.
Save harshityadav95/ef2706f91b0331213588f23b00e19a16 to your computer and use it in GitHub Desktop.
C# Save A Access Record into the database from the values accepted by the user .
try
{
obj1.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = obj1;
MessageBox.Show("Login Succesfull");
//Throwing exception when enteringg data into the same databse
//command.CommandText = "insert into empdata (ID,empname,phone,dob,password) values('" + textBox.Text + "','" + textBox1.Text + "','"+ textBox3.Text + "','"+ textBox4 .Text+ "','"+ textBox2.Text + "')";
command.CommandText = "insert into try (ID,name) values('" + textBox.Text + "','"+ textBox1.Text+ "')";
command.ExecuteNonQuery();
MessageBox.Show("Data Saved ");
obj1.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment