标题:未将对象引用设置到对象的实例。
只看楼主
谢成新
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-7-30
结帖率:0
已结贴  问题点数:20 回复次数:6 
未将对象引用设置到对象的实例。
{
行 80:                 string str = "";
行 81:                 if (this.Request["option"].ToString() == "add")
行 82:                 {
行 83:                     str = "insert into tb_Rule(rule_id,rule_name,effective) values('"+this.TBX_code.Text+"','" +
搜索更多相关主题的帖子: effective insert values 
2013-07-30 10:11
BCCN芥末小弟
Rank: 2
等 级:论坛游民
帖 子:4
专家分:12
注 册:2013-7-30
得分:10 
???什么东东?那一行》
2013-07-30 11:01
谢成新
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-7-30
得分:0 
回复 2楼 BCCN芥末小弟
if (this.Request["option"].ToString() == "add")
                这一行
2013-07-30 11:03
谢成新
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-7-30
得分:0 
回复 3楼 谢成新
public partial class Sys_BranchDetail : TowinCore.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if(!IsPostBack)
            {
               if(this.Request["option"]!=null)
               {
                   if (this.Request["option"] == "add")
                   {

                   }
                   else
                   {
                       this.BindBranchInfo();
                   }
               }
            }
        }


        private void BindBranchInfo()
        {
            string strsql = "select tb_branchId, tb_branchName,effective  from  t_Branch  where  tb_branchId= '" + this.Request["cCode"].ToString() + "'";
            DataTable dt = Db.GetDataTable(strsql);
            this.TBX_Branchcode.Text = dt.Rows[0]["tb_branchId"].ToString();
            this.TBX_Branchname.Text=dt.Rows[0]["tb_branchName"].ToString();
            this.DDL_effective.SelectedValue = dt.Rows[0]["effective"].ToString();
        }

        protected void Btn_Save_Click(object sender, EventArgs e)   //保存部门信息
        {
            if (this.TBX_Branchname.Text == "")
            {
                Response.Write("<script language=javascript>alert('您还没有填写部门名称!')</script>");
            }
            else

            {
                string str = "";
                if (this.Request["option"].ToString() == "add")
                {
                    str = "insert into t_Branch(tb_branchId,tb_branchName,effective) values('" +TBX_Branchcode.Text+ "','" + this.TBX_Branchname.Text + "','" + this.DDL_effective.SelectedValue+ "')";
                }
                else
                {
                    str = "update t_Branch  set tb_branchName='" + this.TBX_Branchname.Text + "' where  tb_branchId='"+this.Request["cCode"].ToString()+"'";
                }
               TowinCore.Db.ExecuteSQL(str);
                Cls_Message.ShowPageMessage("操作成功!", this.Page);
            }


        }

        protected void Btn_Cancel_Click(object sender, EventArgs e)
        {
            //取消操作
            this.TBX_Branchcode.Text = "";
            this.TBX_Branchname.Text = "";
            Response.Write("<script>if(confirm(\"确定取消操作?\")==true){window.close();}</script>");
        }
    }
2013-07-30 11:03
谢成新
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2013-7-30
得分:0 
2013-07-30 11:22
party620
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:696
专家分:2521
注 册:2013-1-31
得分:10 
调试一下,看下
this.Request["option"]是否有值
2013-07-30 11:38
party620
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:696
专家分:2521
注 册:2013-1-31
得分:0 
request.params["option"]
2013-07-30 11:47



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




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

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