コード例 #1
0
        public static Customer getCustomerByAccount(String account)
        {
            Customer customer = new Customer();
            SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
            SqlConnection conn = GetConnection(builder);
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from Customer WHERE Account = @Account";
            cmd.Parameters.AddWithValue("@Account", account);
            conn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    customer.FirstName = dr["FirstName"].ToString();
                    customer.LastName = dr["LastName"].ToString();
                    customer.Age = Convert.ToInt16(dr["Age"]);
                    customer.Gender = dr["Gender"].ToString();
                    customer.Email = dr["Email"].ToString();
                    customer.Account = dr["Account"].ToString();
                    customer.password = dr["password"].ToString();
                    customer.CustID = Convert.ToInt32(dr["CustID"]);
                }
            }
            else
            {
                customer = null;
            }

            return customer;
        }
コード例 #2
0
 partial void DeleteCustomer(Customer instance);
コード例 #3
0
 partial void UpdateCustomer(Customer instance);
コード例 #4
0
 partial void InsertCustomer(Customer instance);