comboBox设置了下拉菜单后,如何将当前内容赋予string类型,我用 string a=comboBox.text不行,a为空值
解决方案 »
- 求教Winfrom多线程与UI响应问题
- vs2008 执行不了当前的项目怎么办啊
- 想要在另一界面动态获取参数
- 关于子窗体调用主窗体axMSComm控件的问题!
- 救助:C#实现打印图像的方法
- 如何防止通过reflector看到程序中的连接字符串??
- 高分求一解两个不同地的数据库(也不同名)但都有一张相同的表tbl_ExamFieldInfo现在就是要比较这两张表,如果下级数据库的这个表同上级
- 在继承中每个类继承了Object定义的哪8个方法?
- treeview控件。请大家重头到尾给列举列举。
- 数据库的一个简单的问题!
- 新手求教 如何将一个.net程序多个文件夹同时打开运行?谢谢
- 关于C#设置属性无效的问题
除非选择的时候触发了什么事件。导致.text值没有了。
SqlConnection conn = new SqlConnection(str);
string Sql = "select mc from zd_yp order by mc";
DataSet Ds = new DataSet();
SqlDataAdapter Da = new SqlDataAdapter(Sql, conn);
Da.Fill(Ds, "zd_ry");
comboBox1.DataSource = Ds.Tables["zd_ry"];
comboBox1.DisplayMember = "mc";
{
string str = "Data Source=192.168.1.1;Database=cbyy;Uid=his;Pwd=samanagger";
SqlConnection conn = new SqlConnection(str);
string Sql = "select mc from zd_yp order by mc";
DataSet Ds = new DataSet();
SqlDataAdapter Da = new SqlDataAdapter(Sql, conn);
Da.Fill(Ds, "zd_ry");
comboBox1.DataSource = Ds.Tables["zd_ry"];
comboBox1.DisplayMember = "mc";
comboBox1.ValueMember = "mc";
comboBox1.SelectedValue= "mc";
}这是触发器的代码
string sql = "select * from zy_bhjfyz" + Convert.ToString(starttime.Year) + starttime.Month.ToString("D2") + " where flag & 16=0 and flag & 2>0 and rq between " + days(Convert.ToDateTime(date1)) + " and " + days(Convert.ToDateTime(date2)) + " and yzmc like '%" + f.comboBox1.Text+"%'";这是SQL语句的代码
不要在这个事件中绑定,在界面加载的时候绑定。
{
string str = "Data Source=192.168.1.1;Database=cbyy;Uid=his;Pwd=samanagger";
SqlConnection conn = new SqlConnection(str);
string Sql = "select mc from zd_yp order by mc";
DataSet Ds = new DataSet();
SqlDataAdapter Da = new SqlDataAdapter(Sql, conn);
Da.Fill(Ds, "zd_ry");
comboBox1.DataSource = Ds.Tables["zd_ry"];
comboBox1.DisplayMember = "mc";
comboBox1.ValueMember = "mc";
comboBox1.SelectedValue= "mc";
}点击事件还是一样的
string sql = "select * from zy_bhjfyz" + Convert.ToString(starttime.Year) + starttime.Month.ToString("D2") + " where flag & 16=0 and flag & 2>0 and rq between " + days(Convert.ToDateTime(date1)) + " and " + days(Convert.ToDateTime(date2)) + " and yzmc ='" + f.comboBox1.Text+"'";
为什么 f.comboBox1.Text 的值为空?