コード例 #1
0
 public static Customer GetCustomer(int id)
 {
     using (SqlConnection con = new SqlConnection(connString, credentials))
     {
         try
         {
             con.Open();
             Dictionary <string, object> p = new Dictionary <string, object>
             {
                 { "@Id", id }
             };
             return(DBActions.ExecReaderSP <Customer>(con, "getCustomerById", p));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return(null);
         }
         finally
         {
             con.Close();
         }
     }
 }