private void toolStripTextBox4_KeyDown(object sender, KeyEventArgs e) { string a = toolStripTextBox4.Text; string from = toolStripComboBox3.Text; if (e.KeyCode == Keys.Enter) { String connectionString = @"Data Source= localhost; Initial Catalog = Магазин_рукоделия; Integrated Security=SSPI;"; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); String SQLStmt = " SELECT * FROM [Вакансия] WHERE [" + from + "] LIKE '" + a + "'"; SqlCommand myCommand = new SqlCommand(SQLStmt, myConnection); SqlDataReader myReader = myCommand.ExecuteReader(); Поиск so = new Поиск(); int k = 1; while (myReader.Read()) { so.richTextBox1.Text += k + ") Должность: " + myReader[1].ToString() + "\n З/П: " + myReader[2].ToString() + "\n описание обязанностей: " + myReader[3].ToString()+ "\n"; k++; } k = 0; toolStripTextBox4.Clear(); so.Show(); } }
private void toolStripTextBox9_KeyDown(object sender, KeyEventArgs e) { string a = toolStripTextBox9.Text; string from = toolStripComboBox8.Text; if (e.KeyCode == Keys.Enter) { String connectionString = @"Data Source= localhost; Initial Catalog = Магазин_рукоделия; Integrated Security=SSPI;"; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); String SQLStmt = " SELECT * FROM [Поставка] WHERE [" + from + "] LIKE '" + a + "'"; SqlCommand myCommand = new SqlCommand(SQLStmt, myConnection); SqlDataReader myReader = myCommand.ExecuteReader(); Поиск so = new Поиск(); int k = 1; while (myReader.Read()) { so.richTextBox1.Text += k + ") ID_Поставщика: " + myReader[0].ToString() + "\n ID_Товара: " + myReader[1].ToString() + "\n ед.измерения: " + myReader[2].ToString() + "\n количество: " + myReader[2].ToString() + "\n"; k++; } k = 0; toolStripTextBox9.Clear(); so.Show(); } }
//private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e) //{ // string a = toolStripTextBox1.Text; // if (e.KeyCode == Keys.Enter) // { // String connectionString = @"Data Source= localhost; Initial Catalog = Магазин_рукоделия; Integrated Security=SSPI;"; // SqlConnection myConnection = new SqlConnection(connectionString); // myConnection.Open(); // String SQLStmt = " SELECT * FROM [Главный офис] WHERE [ID_Главного_офиса] LIKE " + a; // SqlCommand myCommand = new SqlCommand(SQLStmt, myConnection); // SqlDataReader myReader = myCommand.ExecuteReader(); // Поиск so = new Поиск(); // int k = 1; // while (myReader.Read()) // { // so.richTextBox1.Text += k + ") ID_Главного офиса:" + myReader[0].ToString() + ", название:" + myReader[1].ToString() + "\n"; // k++; // } // k = 0; // toolStripTextBox1.Clear(); // so.Show(); // } //} private void toolStripTextBox2_KeyDown(object sender, KeyEventArgs e) { string a = toolStripTextBox2.Text; string from = toolStripComboBox1.Text; if (e.KeyCode == Keys.Enter) { String connectionString = @"Data Source= localhost; Initial Catalog = Магазин_рукоделия; Integrated Security=SSPI;"; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); String SQLStmt = " SELECT * FROM [Филиалы магазина] WHERE [" + from + "] LIKE '" + a + "'"; SqlCommand myCommand = new SqlCommand(SQLStmt, myConnection); SqlDataReader myReader = myCommand.ExecuteReader(); Поиск so = new Поиск(); int k = 1; while (myReader.Read()) { so.richTextBox1.Text += k + ") Направление магазина:" + myReader[2].ToString() + "\n адрес: " + myReader[3].ToString() + "\n контактный телефон: " + myReader[4].ToString() + "\n режим работы" + myReader[5].ToString() + "\n"; k++; } k = 0; toolStripTextBox2.Clear(); so.Show(); } }