当前位置:编程学习 > C#/ASP.NET >>

TXB_SBXX.Text=TXB_SBXX.Text=ds.Tables["S_SBXX"].Rows[0]["SBMC"].ToString();

我用VS开发的,代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["username"] == null)
{
Response.Redirect ("../relogin.aspx");
}
if(!IsPostBack)
{
myconnection=new SqlConnection(strconnection);
myconnection.Open();
                
string gcbh,xmbh;
strsql="select * from S_SBXX where hqdbh='"+Request.QueryString["xh"]+"'";
SqlDataAdapter mydataadapter = new SqlDataAdapter(strsql, myconnection);
mydataadapter.Fill(ds, "S_SBXX");  
TXB_SBXX.Text=ds.Tables["S_SBXX"].Rows[0]["SBMC"].ToString();
gcbh=ds.Tables["S_SBXX"].Rows[0]["GCBH"].ToString();

myconnection.Close();
ds.Clear();
}
}
我加载的页面地址如下:
http://localhost/SPTASK/frame/sp_frame.aspx?url=spedit/equip&xh=sb000001
数据库里也有hqdbh=sb000001的数据信息,为什么在实际加载后TXB_SBXX还是没有内容? --------------------编程问答--------------------

DataSet ds=new DataSet();
mydataadapter.Fill(ds, "S_SBXX"); 
--------------------编程问答-------------------- 好像还是没用,我从同一个项目的另外一个有类似功能的页面复制过来的,但是这个就没法显示,不知道具体原因呢。不知道是query的值不对应还是怎么回事。

引用 1 楼 jayrao5566 的回复:
C# code


DataSet ds=new DataSet();
mydataadapter.Fill(ds, "S_SBXX");
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,