SqlParameter类的使用
/// <summary>
/// 增加一条数据
/// </summary>
public void Add(.Model.Users model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into Users(");
strSql.Append("Uid,Uage,Uname)");
strSql.Append(" values (");
strSql.Append("@Uid,@Uage,@Uname)");
SqlParameter[] parameters = {
new SqlParameter("@Uid", SqlDbType.Int,4),
new SqlParameter("@Uage", SqlDbType.Int,4),
new SqlParameter("@Uname", SqlDbType.VarChar,50)};
parameters[0].Value = model.Uid;
parameters[1].Value = model.Uage;
parameters[2].Value = model.Uname;
DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
}