Exemple #1
0
        //internal static void SupplierProc(IDataReader dr, FieldDictionary Fields, object Param)
        //{
        //    SupplierCollection coll = Param as SupplierCollection;
        //    Supplier item = Mapper.ReadSupplier(dr, Fields);
        //    coll.Add(item);
        //}



        public CustomerCollection GetAllCustomers()
        {
            string     str = @"select CustomerID, CompanyName, ContactName, ContactTitle, Address, City,
				Region, PostalCode, Country, Phone, Fax from Customers"                ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            CustomerCollection cc = new CustomerCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(CustomerProc), cc);
            cc.AcceptChanges();
            return(cc);
        }
Exemple #2
0
        public CustomerCollection GetCustomerByCustomerId(string CustomerId)
        {
            string     str = @"select CustomerID, CompanyName, ContactName, ContactTitle, Address, City,
				Region, PostalCode, Country, Phone, Fax from Customers where CustomerID = @CustomerId"                ;
            SqlCommand cmd = new SqlCommand(str, new SqlConnection(_strCnn));

            cmd.Parameters.Add("@CustomerId", SqlDbType.NChar, 0, "CustomerId");
            cmd.Parameters[0].Value = CustomerId;

            CustomerCollection cc = new CustomerCollection();

            DataRead.RunQuery(cmd, new DataRead.ProcessRow(CustomerProc), cc);
            cc.AcceptChanges();
            return(cc);
        }