Hi!
After making my filter using a datagrid. How can I transfer my row from my test table to another table(for example test2)?
private void button3_Click(object sender, EventArgs e)
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from test where [name] = ? and [absent] = ?";
var param1 = new OleDbParameter("@name", OleDbType.VarChar);
var param2 = new OleDbParameter("@absent", OleDbType.VarChar);
param1.Value = comboBox1.Text;
param2.Value = label4.Text;
cmd.Parameters.Add(param1);
cmd.Parameters.Add(param2);
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
conn.Close();
dataGridView1.DataSource = dt;
}
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tom MohanPosted Apr 9, 2015, 1:26 AM
http://www.c-sharpcorner.com/UploadFile/mahesh/ImportRow07092006195427PM/ImportRow.aspx
Akhil GargPosted Apr 8, 2015, 10:45 PM
http://www.c-sharpcorner.com/UploadFile/31514f/sorting-and-filtering-in-data-table/