示例#1
0
        public static Boolean EditCard(EditCard composite)
        {
            using (SqlConnection connectionstring = new SqlConnection(cstring))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    connectionstring.Open();
                    cmd.CommandText = "UPDATE CardTable SET CardID = @p1 WHERE CardID = @p2";
                    cmd.Parameters.AddWithValue("@p1", composite.NewCardnr);
                    cmd.Parameters.AddWithValue("@p2", composite.OldCardnr);
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection  = connectionstring;

                    try
                    {
                        cmd.ExecuteNonQuery();
                        return(true);
                    }
                    catch
                    {
                        return(false);
                    }
                    finally
                    {
                        connectionstring.Close();
                    }
                }
            }
        }
示例#2
0
 public bool UpdateCard(EditCard composite)
 {
     return(DataHelper.EditCard(composite));
 }
示例#3
0
 public void EditCard(EditCard composite)
 {
     DataHelper.EditCard(composite);
 }