string sqlstr = "select * from Unit";
try
{
con = new SqlConnection(strsqlcon);
con.Open();
cmd = new SqlCommand(sqlstr, con);
reader = cmd.ExecuteReader();
ddlweightunit.Items.Clear();
while (reader.Read())
{
ddlweightunit.Items.Add(new ListItem ( reader["UnitName"].ToString(),""));
}
reader.Close();
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
finally
{
con.Close();
}
try
{
con = new SqlConnection(strsqlcon);
con.Open();
cmd = new SqlCommand(sqlstr, con);
reader = cmd.ExecuteReader();
ddlweightunit.Items.Clear();
while (reader.Read())
{
ddlweightunit.Items.Add(new ListItem ( reader["UnitName"].ToString(),""));
}
reader.Close();
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
finally
{
con.Close();
}
解决方案 »
- 透明窗体如何接收到鼠标的点击?
- winfrom安装包
- 复制table的row的问题::无法将类型为“System.Data.DataRow”的对象强制转换为类型“System.IConvertible”。
- C# 小弟实在是写不出来了 请各位大哥们帮忙 谢谢
- 急急急!!!!!!!如何在登陆成功后把用户名写进profile 救命啊
- C# 声道问题
- 谁能帮我将"易我秀www.eoshow.com公司"的流氓处理掉
- remoting 问题
- toolStrip的backcolor问题
- 请教:intranet application? 和做intrenet application有什么不一样吗?公司要求做intranet application, 只在公司内部用。一点头绪都没有,请指教
- C# 实现数据暂存
- 如何判断现在我鼠标点击的是哪个控件?
谢谢你.
您好!
能否帮我看看这个问题?非常感谢!
http://community.csdn.net/Expert/topic/5600/5600686.xml?temp=.6444666