标签:comm word update pass HERE val scn row date
if (id != null)
{
sql = @"update [User] set Username = @Username, Password = @Password, Type = @UserType, FullName = @FullName, Telephone = @Telephone, Department = @Department where ID=" + id;
}
else
{
sql = @"insert into [User] (Username, Password, Type, FullName, Telephone, Department) values (@Username, @Password, @UserType, @FullName, @Telephone, @Department)";
}
SqlParameter[] parms = new SqlParameter[]
{
new SqlParameter("@UserType", usertype),
new SqlParameter("@Username", sname),
new SqlParameter("@Password", spwd),
new SqlParameter("@FullName", fullname),
new SqlParameter("@Telephone", telephone),
new SqlParameter("@Department", dept)
};
SqlConnection conn = new SqlConnection(scnn);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.AddRange(parms);
var row = cmd.ExecuteNonQuery();
conn.Close();
标签:comm word update pass HERE val scn row date
原文地址:https://www.cnblogs.com/asdyzh/p/9746323.html