这些代码写在窗体的按钮的事件处理程序中
private void button3_Click(object sender, EventArgs e)
{
try
{
string temp = "insert into [user] ([username], [password], [email]) values ('a','b','c') ";
this.oleDbConnectionTest.ConnectionString = this.mycon;
this.oleDbConnectionTest.Open();
MessageBox.Show(temp);
oleDbCommandTest.CommandType = CommandType.Text;
oleDbCommandTest.CommandText = temp;
oleDbCommandTest.Connection = oleDbConnectionTest;
oleDbDataAdapterTest.InsertCommand = oleDbCommandTest;
oleDbDataAdapterTest.InsertCommand.ExecuteNonQuery();
oleDbDataAdapterTest.Fill(this.DataSetTest);
///刷新的代码,我不会写。谢谢。
this.oleDbConnectionTest.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
private void button3_Click(object sender, EventArgs e)
{
try
{
string temp = "insert into [user] ([username], [password], [email]) values ('a','b','c') ";
this.oleDbConnectionTest.ConnectionString = this.mycon;
this.oleDbConnectionTest.Open();
MessageBox.Show(temp);
oleDbCommandTest.CommandType = CommandType.Text;
oleDbCommandTest.CommandText = temp;
oleDbCommandTest.Connection = oleDbConnectionTest;
oleDbDataAdapterTest.InsertCommand = oleDbCommandTest;
oleDbDataAdapterTest.InsertCommand.ExecuteNonQuery();
oleDbDataAdapterTest.Fill(this.DataSetTest);
///刷新的代码,我不会写。谢谢。
this.oleDbConnectionTest.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货