Как в ContextMenuStrip ComboBox_Enter загрузить данные из столбца таблицы SQL?
Как в ContextMenuStrip ComboBox_Enter загрузить данные из столбца таблицы SQL? Или там не Enter должен использоваться, а что-то другое?
код:
public void toolStripComboBox1_Enter(object sender, EventArgs e)
{
string conStr = @"Data Source=ZUBA\SQLEXPRESS;Initial Catalog=diplom; Integrated Security=True";
SqlConnection con = new SqlConnection(conStr);
con.Open();
SqliteCommand select_protocols = new SqliteCommand("SELECT Название FROM proekti ORDER BY Название", con);
using (SqliteDataReader select_protocols_read = select_protocols.ExecuteReader())
{
while (select_protocols_read.Read())
{
if (!contextMenuStrip1.Items.Contains(select_protocols_read.GetString(0)))
{
comboBox.Items.Add(select_protocols_read.GetString(0));
}
}
}
//string lala = "SELECT*From proekti where Название";
//SqlCommand command = new SqlCommand(lala, con);
////SqlCommand com = new SqlCommand("select*from proekti where Название='", con);
//Proekto();
}
