ComboBox控件输入文本弹出下拉列表根据输入的文本在数据库查找~~ onchange事件中,根据内容区select数据集,然后遍历数据集,添加到items 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 选择a,返回b private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string Sql = "select b from table where a =' " + comboBox1.SelectedItem + "'' "; string connectionString = "Data Source=192.168.1.3;Initial Catalog=data;User ID=sa;password=sa;Integrated Security=False"; string queryString = Sql; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); try { while (reader.Read()) { textBox1.Text = reader[0].ToString(); } } finally { command.Dispose(); connection.Close(); } } } select * from phonetable where name like '%"+txtBoxID.text+"%' http://bbs.csdn.net/topics/390324804像百度那样的 C# tcpclient asp网页中获取客户端IP地址,怎样构造一个程序,使打开这个网页时让它获取不同的IP UltraGrid导出excel保留小数点位数的问题 C#如何获得数据库中指定表的空表对象(问题不易描述,请看具体内容) WPF有没有开源免费的主题 C#解析XML超长字符串的问题!高分求助!! 紧急求救:des加密解密和数据库问题 一个邮箱的问题,急 c/s结构网络的问题 我qq=84845808,欢迎大家指教 新人发帖求助关于listbox双击事件的一系列问题 有没有办法在image控件上加上textbox,也就是实现在图片上写字?
选择a,返回b
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string Sql = "select b from table where a =' " + comboBox1.SelectedItem + "'' ";
string connectionString = "Data Source=192.168.1.3;Initial Catalog=data;User ID=sa;password=sa;Integrated Security=False";
string queryString = Sql;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
textBox1.Text = reader[0].ToString();
}
}
finally
{
command.Dispose();
connection.Close(); }
}
}
像百度那样的