S
starforce
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
OleDbConnection conn = new OleDbConnection(connString);
string sqlstr2="UPDATE books "
+
"SET "
+
"
书名=sm, "
+
"
作者=zz, "
+
"
价格=jg, "
+
"
书架号=sjh "
+
"
WHERE 图书编号=tsbh";
OleDbCommand myCommand=conn.CreateCommand();
myCommand.CommandText=sqlstr2;
myCommand.Parameters.Clear();
myCommand.Parameters.Add("tsbh",OleDbType.Numeric,10);
myCommand.Parameters.Add("sm",OleDbType.Char,50);
myCommand.Parameters.Add("zz",OleDbType.Char,50);
myCommand.Parameters.Add("jg",OleDbType.Numeric,10);
myCommand.Parameters.Add("sjh",OleDbType.Numeric,10);
myCommand.Parameters["tsbh"].Value=Int32.Parse(TextBox1.Text);
myCommand.Parameters["sm"].Value=TextBox2.Text;
myCommand.Parameters["zz"].Value=TextBox3.Text;
myCommand.Parameters["jg"].Value=Int32.Parse(TextBox4.Text);
myCommand.Parameters["sjh"].Value=Int32.Parse(TextBox5.Text);
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();
OleDbConnection conn = new OleDbConnection(connString);
string sqlstr2="UPDATE books "
+
"SET "
+
"
书名=sm, "
+
"
作者=zz, "
+
"
价格=jg, "
+
"
书架号=sjh "
+
"
WHERE 图书编号=tsbh";
OleDbCommand myCommand=conn.CreateCommand();
myCommand.CommandText=sqlstr2;
myCommand.Parameters.Clear();
myCommand.Parameters.Add("tsbh",OleDbType.Numeric,10);
myCommand.Parameters.Add("sm",OleDbType.Char,50);
myCommand.Parameters.Add("zz",OleDbType.Char,50);
myCommand.Parameters.Add("jg",OleDbType.Numeric,10);
myCommand.Parameters.Add("sjh",OleDbType.Numeric,10);
myCommand.Parameters["tsbh"].Value=Int32.Parse(TextBox1.Text);
myCommand.Parameters["sm"].Value=TextBox2.Text;
myCommand.Parameters["zz"].Value=TextBox3.Text;
myCommand.Parameters["jg"].Value=Int32.Parse(TextBox4.Text);
myCommand.Parameters["sjh"].Value=Int32.Parse(TextBox5.Text);
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();