Пример #1
0
        public PrinterReg Search()
        {
            // string q = "Select * from PrinterReg";
            SqlCommand cmd = new SqlCommand("SP_PrinterRegSearch", connection.GetConnection());

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PrinterID", PrinterID);
            SqlDataReader sdr = cmd.ExecuteReader();
            PrinterReg    pr  = new PrinterReg();

            while (sdr.Read())
            {
                pr.PrinterID = (int)sdr["PrinterId"];
                pr.OwnerName = (string)sdr["OwnerName"];
                pr.Country   = (string)sdr["Country"];
                pr.Address   = (string)sdr["Address"];
                pr.City      = (string)sdr["City"];
                pr.Country   = (string)sdr["Country"];
            }
            sdr.Close();
            return(pr);
        }
Пример #2
0
        public List <PrinterReg> ShowAll()
        {
            // string q = "Select * from PrinterReg";
            SqlCommand cmd = new SqlCommand("PrinterRegShowAll", connection.GetConnection());

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            SqlDataReader     sdr = cmd.ExecuteReader();
            List <PrinterReg> lst = new List <PrinterReg>();

            while (sdr.Read())
            {
                PrinterReg pr = new PrinterReg();

                pr.PrinterID = (int)sdr["PrinterId"];
                pr.OwnerName = (string)sdr["OwnerName"];
                pr.Country   = (string)sdr["Country"];
                pr.Address   = (string)sdr["Address"];
                pr.City      = (string)sdr["City"];
                pr.Country   = (string)sdr["Country"];
                lst.Add(pr);
            }
            sdr.Close();
            return(lst);
        }