static public List <string> GetData()
            {
                List <string> data = new List <string>();

                using (SqlConnection conn = new SqlConnection("Data Source=DESKTOP-Q1K44I8\\SA;Initial Catalog=Item2;Integrated Security=True"))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = conn;
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "SELECT distinct BatchNumber FROM ItemBarcode";

                        ReprintBarcode rb = new ReprintBarcode();

                        try
                        {
                            conn.Open();

                            using (SqlDataReader read = cmd.ExecuteReader())
                            {
                                for (int i = 0; i < rb.BatchNumberQuantity(); i++)
                                {
                                    read.Read();
                                    data.Add(read["BatchNumber"].ToString());
                                }
                            }
                        }
                        catch
                        {
                            //MessageBox.Show("Search Failed");
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }

                    return(data);
                }
            }
Beispiel #2
0
        private void btn_Reprint_Click(object sender, RoutedEventArgs e)
        {
            var ReprintBarcode = new ReprintBarcode();

            ReprintBarcode.Show();
        }