标题:未将对象引用设置到对象的实例
取消只看楼主
冷月烟云梦
Rank: 1
来 自:河南
等 级:新手上路
帖 子:14
专家分:0
注 册:2011-6-2
结帖率:75%
已结贴  问题点数:10 回复次数:0 
未将对象引用设置到对象的实例
public void GetGoodsInfo()
    {
        string strSql = "select * from Goodsinfo where Goodsid=" + Convert.ToInt32(Request["id"].Trim());
        SqlCommand myCmd = db0bj.GetCommandStr(strSql);
        DataTable dsTable = db0bj.GetDataSetStr(strSql, "Gdif");
        this.txtCategory.Text = gc0bj.GetClass(Convert.ToInt32(dsTable.Rows[0]["TypeID"].ToString()));
        this.txtName.Text = dsTable.Rows[0]["Goodsname"].ToString();
        this.txtAuthor.Text = dsTable.Rows[0]["Goodsauthor"].ToString();
        this.txtCompany.Text = dsTable.Rows[0]["Goodscompany"].ToString();
        this.txtMarketPrice.Text = dsTable.Rows[0]["Goodsmarketprice"].ToString();
        this.txtHotPrice.Text = dsTable.Rows[0]["GoodshotPrice"].ToString();
        this.ImageMapPhoto.ImageUrl = dsTable.Rows[0]["Goodsurl"].ToString();
        this.cbxCommend.Checked = dsTable.Rows[0]["Isrefinement"].ToString();


        this.isbool(cbxCommend, dsTable.Rows[0]["Isrefinement"].ToString());
        this.isbool(cbxDiscount, dsTable.Rows[0]["IsDiscount"].ToString());
        this.isbool(cbxHot, dsTable.Rows[0]["IsHot"].ToString());
        this.txtShortDesc.Text = dsTable.Rows[0]["GoodsIntroduce"].ToString();
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        string strUrl = Session["address"].ToString();
        Response.Redirect(strUrl);
    }
    public void isbool(CheckBox c, string s)
    {
        if (s=="1")
        {
            c.Checked = true;
            return;
        }
else
{
   c.Checked = false;
    return;


我是新手,实在不明白错在哪里了,很是郁闷……希望高手能给我一点儿指教!谢谢……
还有我在数据库中将Isrefinement,Isdiscount,Ishot的数据类型设置为char类型了,在这里无法将string转换为bool类型。但是在sql server 数据库中没有bool类型,只有bit类型,怎么办?在数据库中修改它的类型会提示丢失数据,最后还是没有修改成功,怎么办?
搜索更多相关主题的帖子: void public where 
2012-05-09 04:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-367213-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.308631 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved