public MySqlCommand GetAddCommand(VUsers obj) { MySqlCommand cmd = new MySqlCommand(); string sql="insert into testdb.v_users(id,username,password) values(?id, ?username, ?password)"; cmd.CommandText = sql; cmd.Parameters.Add(new MySqlParameter("?id", SqlDataUtil.ToDBNullValue(obj.Id))); cmd.Parameters.Add(new MySqlParameter("?username", SqlDataUtil.ToDBNullValue(obj.Username))); cmd.Parameters.Add(new MySqlParameter("?password", SqlDataUtil.ToDBNullValue(obj.Password))); return cmd; }
public int Add(VUsers obj) { MySqlCommand cmd = GetAddCommand(obj); return (int)SqlUtil.ExecuteNonQuery(cmd); }
public static int Add(VUsers obj) { return helper.Add(obj); }