Created
July 30, 2016 11:39
-
-
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 .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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