插入数据Parameters.add

来源:互联网 发布:数据库接口 api 编辑:程序博客网 时间:2024/06/04 21:10
StrSql = "insert into UserInfo (UserName,UserPassword) values(@UserName,@UserPassword)";
SqlCommand MyComm = new SqlCommand(StrSql,MyConn);
MyComm.Parameters.Add("@UserName",SqlDbType.VarChar,20);
MyComm.Parameters.Add("@UserPassword",SqlDbType.VarChar,20);
MyComm.Parameters["@UserName"].Value = this.TextBox1.Text;
MyComm.Parameters["@UserPassword"].Value = this.TextBox2.Text;

MyComm.ExecuteNonQuery();
原创粉丝点击