Пример #1
0
        private void searchProviderById()
        {
            String query = ("SELECT Id FROM Providers WHERE Id=@id");

            using (connectionSql = new SqlConnection(connectionString))
                using (SqlCommand command = new SqlCommand(query, connectionSql))
                {
                    connectionSql.Open();
                    command.Parameters.AddWithValue("@id", Int32.Parse(searchTxtBox.Text));
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                ProviderReport providerReport = new ProviderReport(reader.GetInt32(0));
                                providerReport.Show();
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Invalid Provider Id");
                        }
                        reader.Close();
                    }
                }
        }
Пример #2
0
        private void provBt_Click(object sender, EventArgs e)
        {
            int            id             = Int32.Parse(ProvComboBox.SelectedValue.ToString());
            ProviderReport providerReport = new ProviderReport(id);

            providerReport.Show();
        }