Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**public void RefreshTable()
- {
- string connectionString = "data source=localhost; initial catalog = owo; persist security info = True; Integrated Security = SSPI; ";
- //comboBox1.SelectedIndex == null ? comboBox1.SelectedIndex := 0 : string selectedTable = comboBox1.SelectedItem.ToString();
- //comboBox1.SelectedIndex = 0; / if (selectedTable) { selectedTable = 0; }
- string selectedTable = comboBox1.SelectedItem.ToString();
- string sql = $"SELECT * FROM [{selectedTable} WHERE id < 0]";
- using (SqlConnection connection = new SqlConnection(connectionString))
- {
- connection.Open();
- // Создаем объект DataAdapter
- SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
- // Создаем объект Dataset
- DataSet ds = new DataSet();
- // Заполняем Dataset
- adapter.Fill(ds);
- // Отображаем данные
- dataGridView1.DataSource = ds.Tables[0];
- }
- }
- public Add_Form()
- {
- InitializeComponent();
- }
- private void refresh_button_Click(object sender, EventArgs e)
- {
- RefreshTable();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- string selectedTable = comboBox1.SelectedItem.ToString();
- }**/
- public Add_Form()
- {
- InitializeComponent();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement