Israel

Israel

  • 693
  • 1.3k
  • 219.5k

Table to table

Apr 8 2015 2:32 PM
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;
}
 

Answers (2)