类返回值使用的问题

gztb7924 2003-12-01 04:38:15
我在做一个程序的时候要多次用到一段程序,我把这段程序放在一个webservice的类中,并写了一个方法bmz_value,它的返回值为System.Web.UI.HtmlControls.HtmlSelect
可是我在页面中是这样使用的this.bmz = (new webservice()).bmz_value
可是它并没有任何东西。请大家帮我看看。
...全文
92 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
NetAnt007 2003-12-02
  • 打赏
  • 举报
回复
这怎么帮你看啊,什么都没有啊,
贴代码,或者说的详细点儿
saucer 2003-12-02
  • 打赏
  • 举报
回复
why do you want to return a HtmlSelect???? return an Array or DataSet
gztb7924 2003-12-02
  • 打赏
  • 举报
回复
补充一下,我用的数据库是Informix数据库,版本有点低,所以不能判断它是否结束。
gztb7924 2003-12-02
  • 打赏
  • 举报
回复
webservice里面的方法
public System.Web.UI.HtmlControls.HtmlSelect bmz_value()
{
int counts = 0;
string sql = "select count(*) as counts from bmz";
this.conn.ConnectionString = webservice.conn_value;
this.comm.Connection = this.conn;
this.comm.CommandText = sql;
System.Data.Odbc.OdbcDataReader myr;
this.conn.Open();
myr = this.comm.ExecuteReader();
if (myr.Read())
counts = int.Parse(myr[0].ToString().Trim());
this.conn.Close();
myr.Close();
this.bmz.Items.Clear();
System.Web.UI.WebControls.ListItem temp = new System.Web.UI.WebControls.ListItem();
temp.Text = "全部";
temp.Value = "全部";
this.bmz.Items.Add(temp);
if (counts > 0 )
{
sql = "select bmzmc,bmzdm from bmz";
this.comm.CommandText = sql;
this.conn.Open();
myr = this.comm.ExecuteReader();
if (myr.Read())
{

do
{
counts--;
temp = new System.Web.UI.WebControls.ListItem(myr[0].ToString().Trim(),myr[1].ToString().Trim());
this.bmz.Items.Add(temp);
if (counts > 0)
myr.Read();
}
while(counts > 0);
}

}
return this.bmz;
}

在页面中是这样使用的this.bmz = (new webservice()).bmz_value语句,可是运行的时候一点反应也没有。
rock1981 2003-12-02
  • 打赏
  • 举报
回复
对啊!楼主把代码贴出来看看具体问题具体解决嘛!
gztb7924 2003-12-01
  • 打赏
  • 举报
回复
大家帮帮忙,在线等待!

12,165

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧