Ejemplo n.º 1
0
            static public List <string> GetData()
            {
                List <string> stringCollection = 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 Item_Code from ItemMaster";

                        DeleteItemMaster dM = new DeleteItemMaster();

                        try
                        {
                            conn.Open();

                            using (SqlDataReader reader = cmd.ExecuteReader())
                            {
                                for (int i = 0; i < dM.CodeQuantity(); i++)
                                {
                                    reader.Read();
                                    stringCollection.Add(reader["Item_Code"].ToString());
                                }
                            }
                        }
                        catch
                        {
                            //System.Windows.MessageBox.Show("Search Failed");
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }

                    return(stringCollection);
                }
            }
Ejemplo n.º 2
0
        private void btn_DeleteItem_Click(object sender, RoutedEventArgs e)
        {
            var DeleteItemMaster = new DeleteItemMaster();

            DeleteItemMaster.Show();
        }