using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class manage_EditOrdering : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        data UserLooking = new data();
        UserLooking.UserLogin();
        if (!IsPostBack)
        {
            ReaderOrdering();
            //ReaderPro();
            
           
           
        }
    }
    public string thisOrderingID;    public void ReaderOrdering()
    {
        if (Request.QueryString["ID"] != "")
        {
            try
            {
                int Rqid = Convert.ToInt32(Request.QueryString["id"]);
                data Reader = new data();
                DataSet ds = Reader.ReturnDataSet("select ProID,ProColor,ProSize,ProDate,ProCount,ProContent,PeoType,PeoPeo,PeoPhone,PeoTel,PeoFax,PeoEmail,ProDate,State from ordering where 编号=" + Rqid + "");
                thisOrderingID = ds.Tables[0].Rows[0][0].ToString();
                Lbcolor.Text = ds.Tables[0].Rows[0][1].ToString();
                Lbsize.Text = ds.Tables[0].Rows[0][2].ToString();
                LbDate.Text = ds.Tables[0].Rows[0][3].ToString();
                Lbcount.Text = ds.Tables[0].Rows[0][4].ToString();
                Lbcenter.Text = ds.Tables[0].Rows[0][5].ToString();
                Lbtype.Text = ds.Tables[0].Rows[0][6].ToString();
                Lbpeo.Text = ds.Tables[0].Rows[0][7].ToString();
                Lbphone.Text = ds.Tables[0].Rows[0][8].ToString();
                Lbtel.Text = ds.Tables[0].Rows[0][9].ToString();
                Lbfax.Text = ds.Tables[0].Rows[0][10].ToString();
                Lbemail.Text = ds.Tables[0].Rows[0][11].ToString();
                DropDownList1.SelectedValue = ds.Tables[0].Rows[0][13].ToString();            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
        else
        {
           
        }
            }
    //public void ReaderPro()
    //{
    //    data Read = new data();
    //    DataSet dsRead = Read.ReturnDataSet("selete name from Product where id=" + Convert.ToInt32(thisOrderingID) + "");
    //    Proname.Text = dsRead.Tables[0].Rows[0][0].ToString();    //}    protected void sumbit_Click(object sender, EventArgs e)
    {
        data updateordering = new data();
        updateordering.ExecuteSql("update ordering set State='" + DropDownList1.Text.ToString() + "' where 编号=" + Convert.ToInt32(Request.QueryString["id"]) + "");
    }
}加上注释的代码就出问题.帮忙看看吧

解决方案 »

  1.   

    public string thisOrderingID; 
    这样声明是保存不了的,页面提交后这个class会重新实例化 thisOrderingID也会变为null这样声明  public string thisOrderingID
            {
                get
                {
                    return ViewState["thisOrderingID"] != null ? (string)ViewState["thisOrderingID"] : string.Empty;
                }
                set
                {
                    ViewState["thisOrderingID"] = value;
                }
            }