我是 windows mobile 6 的初学者,我试图将值传递给数据库,但 itz 不工作没有错误和警告请检查我的代码并帮助我.. 数据库没有更新..
private void button1_Click(object sender, EventArgs e)
{
string conSTR = "data source= " +
(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) +
"\\DPass.sdf; Persist security info=False";
SqlCeConnection connection = new SqlCeConnection(conSTR);
SqlCeCommand cmd = new SqlCeCommand("INSERT INTO cusTable(Fname,Lname) VALUES(@Fname,@Lname)",connection);
cmd.Parameters.AddWithValue("@Fname", textBox1.Text);
cmd.Parameters.AddWithValue("@Lname", textBox2.Text);
connection.Open();
int affectedRows = cmd.ExecuteNonQuery();
cmd.ExecuteNonQuery();
MessageBox.Show("ela");
connection.Close();
}