Ejemplo n.º 1
0
        public static List <SerialNumbers> GetSerialNumber(DateTime startDate, DateTime endDate)
        {
            List <SerialNumbers> retlist = new List <SerialNumbers>();

            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = _ReadConnectionString;
            try
            {
                conn.Open();
                SqlCommand comm = new SqlCommand("sprocReturnsSerialNumber", conn);
                comm.CommandType = System.Data.CommandType.StoredProcedure;

                comm.Parameters.AddWithValue("@FirstDate", startDate);
                comm.Parameters.AddWithValue("@SecondDate", endDate);
                SqlDataReader dr = comm.ExecuteReader();

                while (dr.Read())
                {
                    SerialNumbers sn = new SerialNumbers();
                    sn.Fill(dr);
                    retlist.Add(sn);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(retlist);
        }