hallo ,
Iam trying to insert a row into access table. the values i insert is from textboxes. iam using visual c# .. No error is there but the row is not there after the execution, here is my code.
private void button1_Click(o bject sender, EventArgs e)
{
txt1 = textBox1.Text;
txt2 = textBox2.Text;
String connectionStrin g = "Provider=Micro soft.ACE.OLEDB. 12.0;Data Source=C:\\User info.accdb";
OleDbConnection connection = new OleDbConnection (connectionStri ng);
OleDbDataAdapte r adapter = new OleDbDataAdapte r();
OleDbCommand command;
// Create the InsertCommand.
command = new OleDbCommand("I NSERT INTO userinfo (Username, Pwd) VALUES (‘" + txt1 + "’ , ‘" + txt2 + "’)", connection);
connection.Open ();
adapter.InsertC ommand = command;
connection.Clos e();
}
Thank you..
Dinesh.
Iam trying to insert a row into access table. the values i insert is from textboxes. iam using visual c# .. No error is there but the row is not there after the execution, here is my code.
private void button1_Click(o bject sender, EventArgs e)
{
txt1 = textBox1.Text;
txt2 = textBox2.Text;
String connectionStrin g = "Provider=Micro soft.ACE.OLEDB. 12.0;Data Source=C:\\User info.accdb";
OleDbConnection connection = new OleDbConnection (connectionStri ng);
OleDbDataAdapte r adapter = new OleDbDataAdapte r();
OleDbCommand command;
// Create the InsertCommand.
command = new OleDbCommand("I NSERT INTO userinfo (Username, Pwd) VALUES (‘" + txt1 + "’ , ‘" + txt2 + "’)", connection);
connection.Open ();
adapter.InsertC ommand = command;
connection.Clos e();
}
Thank you..
Dinesh.
Comment