日期:2014-05-16  浏览次数:20441 次

如何将四联动DropDownList中的值用存储过程存入数据库,急用,急用...
C#代码:
#region   GetDataSet
public   static   DataSet   GetDataSet(string   sql)
{
SqlDataAdapter sda   =new   SqlDataAdapter(sql,ConnectionString);
DataSet   ds=new   DataSet();
sda.Fill(ds);
return   ds;
}
#endregion

#region   property
private   string   FirstID
{
    get
{
if(ViewState[ "FirstID "]!=null   &&   ViewState[ "FirstID "].ToString()!= " ")
  {
return   ViewState[ "FirstID "].ToString();
  }
else
{
if(Request[ "FirstID "]!=null   &&   Request[ "FirstID "].ToString()!= " ")
{
return   Request[ "FirstID "];
}
else
{
return   " ";
}
        }
}
set
{
ViewState[ "FirstID "]=value;
}
}
private   string   SecondID
{
get
{
if(ViewState[ "SecondID "]!=null   &&   ViewState[ "SecondID "].ToString()!= " ")
{
return   ViewState[ "SecondID "].ToString();
}
else
{
if(Request[ "SecondID "]!=null   &&   Request[ "SecondID "].ToString()!= " ")
{
return   Request[ "SecondID "];
}
else
{
return   " ";
}
}
}
set
{
ViewState[ "FirstID "]=value;
}
}

private   string   ThirdID
{
get
{
if(ViewState[ "ThirdID "]!=null   &&   ViewState[ "ThirdID "].ToString()!= " ")
{
return   ViewState[ "ThirdID "].ToString();
}
else
{
if(Request[ "ThirdID "]!=null   &&   Request[ "ThirdID "].ToString()!= " ")
{
return   Request[ "ThirdID "];
}
else
{
return   " ";
}
}
}
set
{
ViewState[ "FirstID "]=value;
}
}
#endregion

#region   Page_Load
private   void   Page_Load(object   sender,   System.EventArgs   e)
{
if(!this.IsPostBack)
   {
     this.down1_bind();
this.DropDownList1.Attributes.Add( "onchange ", "XmlPost2(this); ");
this.DropDownList2.Attributes.Add( "onchange ", "XmlPost3(this); ");
this.DropDownList3.Attributes.Add( "onchange ", "XmlPost4(this); ");
   }
   if(FirstID   !=   " ")
   {
     this.down2_bind(FirstID);
   }
if(SecondID   !=   " ")
   {
     this.down3_bind(SecondID);
   }
if(ThirdID   !=   " ")
{
  this.down4_bind(ThirdID);
}
}

#endregion

#region   down2_bind
private   void   down2_bind(string   id)
{
   string   mystr   =   " ";
string   sql   =   "select   SecondID,SecondName   from   Column2   where   Father   =