for (int i=1;i<=5;i++)
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
Label_i.Text=AdStr_1;//
}
dr.Close();
Conn.Close();
}
}
请教
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
Label_i.Text=AdStr_1;//
}
dr.Close();
Conn.Close();
}
}
请教
解决方案 »
- 根据多条记录中,某相同字段汇总,生成其不同字段的新记录?
- 从数据类型 decimal 转换为 numeric 时出错,怎么回事?郁闷死了!
- 登陆ASP.NET页面时,为什么会自动补加一段代码???
- VS2005是不是不支持很多HTML标签?
- .NETG下如何捕捉access中重复值异常?
- 返回上一页功能:我看到了很多帖子,但是一个都没有试成功,虚心请教。
- 想得到50分的人就进来帮我解决这个问题吧!!!!!
- OleDb读取Excel时, 如何使用sql条件查询
- ASP.NET里如何获得当前计算机的用户登陆密码?
- 十六进制数据的数组
- 刚开始学:3个问题:变量如何定义,在每个页面中引用后就可以;2、模块问题?3、引用问题
- 刚学:导致该错误的原因可能是在 IIS 中没有将虚拟目录作为应用程序进行配置
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
string aa=Label_+i.Tostring();
Label aa=new Label();
aa.Text=ADStr_1;
}
dr.Close();
Conn.Close();
}
}
for (int i=1;i<=5;i++)
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
string aa="Label_"+i.Tostring();
Label aa=new Label();
aa.Text=ADStr_1;
}
dr.Close();
Conn.Close();
}
}
2.已在此范围定义了名为“aa”的局部变量。
3.“string”并不包含对“Text”的定义
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
Label aa=new Label();
aa.Text=ADStr_1;
}
dr.Close();
Conn.Close();
}
}
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
}
Label lbl=Page.FindControl("Label_"+i.ToString());
if(lbl!=null)
lbl.Text=AdStr_1;
dr.Close();
Conn.Close();
}
}
如何取Label的值
{
SqlCommand My_cmd=new SqlCommand("select * from adv_adv where adv_id="+i+"",Conn);
Conn.Open();
SqlDataReader dr=My_cmd.ExecuteReader();
while(dr.Read())
{
AdStr_1=dr["adv_destine"].ToString;
}
Label lbl=(Label)Page.FindControl("Label_"+i.ToString());
if(lbl!=null)
lbl.Text=AdStr_1;
dr.Close();
Conn.Close();
}
}
多谢你,已经测试通过?