public Search(Account account, LogInSignUp form) { InitializeComponent(); currentaccount = account; if (currentaccount.type == "Покупатель") { LoadWork.Visible = false; } this.form = form; string connectionString = @"Data Source=LAPTOP-96NT0MPR;Initial Catalog=kursach;Integrated Security=True"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(); command.Connection = connection; string sqlExpression = "SELECT * FROM Техника_исполнения"; SqlCommand commandread = new SqlCommand(sqlExpression, connection); SqlDataReader reader = commandread.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) // построчно считываем данные { comboBoxSearch.Items.Add(reader.GetString(1)); } } } }
public LogInForm(LogInSignUp form) { InitializeComponent(); this.form = form; }