未将对象引用设置到对象的实例
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类型,怎么办?在数据库中修改它的类型会提示丢失数据,最后还是没有修改成功,怎么办?