private void buttonView_Click(object sender, EventArgs e)
        {
            SqlConnection SQLconn = SQLServerConnection.SQLConnection();

            using (SqlDataAdapter dataAdapter = new SqlDataAdapter("dbo.ViewMenu", SQLconn))
            {
                var command = new SqlCommandBuilder(dataAdapter);
                var ds      = new DataSet();
                dataAdapter.Fill(ds);
                dataGridView.DataSource = ds.Tables[0];
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
        }
Exemple #2
0
        private void buttonSearchStall_Click(object sender, System.EventArgs e)
        {
            string        Stall   = "%" + textBoxStallName.Text + "%";
            SqlConnection SQLconn = SQLServerConnection.SQLConnection();

            using (SqlCommand command = new SqlCommand("dbo.SearchStall", SQLconn))
            {
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add("@NameStall", SqlDbType.VarChar, 100).Value = Stall;
                var            ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                SQLconn.Open();
                da.SelectCommand = command;
                da.Fill(ds);
                MMF.dataGridView.DataSource = ds.Tables[0];
            }
            SQLServerConnection.CloseSQLConnection(SQLconn);
        }