1.用dropdownlist打开一个页面.
设置DowdDropList的autopostback为false
page_load事件中:
if (!IsPostBack)
{
dropdownlist1.Attributes.Add("onchange","parent.frames['框架另一页的名称'].reload();");
}
设置DowdDropList的autopostback为false
page_load事件中:
if (!IsPostBack)
{
dropdownlist1.Attributes.Add("onchange","parent.frames['框架另一页的名称'].reload();");
}
选择事件?服务器事件?
private void DowdDropList_SelectChanged(o,e)
{
Response.Write("<script>parent.frames['框架另一页的名称'].reload();</script>");
//或者用Page.RegisterStartupScript( )
}
2.分开语句
sql=""
+"";
看到一代码:
public DataSet GoodsInfo(string timeFrom,string timeTO,string GoodsType,string GoodsNo,string lineUser,string lineAcpt,string Material,string lineID,string Guard,string transAcpt,string Truck)
{
string SQL,tmpSQL;
System.Data.DataSet dSet;
System.Data.SqlClient.SqlDataAdapter adapter;

tmpSQL = "";
if(timeFrom!=""&timeTO!="")
{
tmpSQL += "And a.input_time >='" + timeFrom + "' And a.input_time <= '" + timeTO + "' ";
}
if(GoodsType != ""&&GoodsType != "All")
tmpSQL += "And a.Goods_Type = '" + GoodsType + "' ";
if(lineUser != "")
tmpSQL += "And a.input_user='" + lineUser + "' ";
if(lineAcpt != "")
tmpSQL += "And a.exel_acceptor='" + lineAcpt + "' ";
if(Material != "")
tmpSQL += "And a.Material_code='" + Material + "' ";
if(lineID != "")
tmpSQL += "And a.line_id IN (" + lineID + ") ";
if(Guard != "")
tmpSQL += "And c.nokia_guard='" + Guard + "' ";
if(transAcpt != "")
tmpSQL += "And c.exel_acceptor='" + transAcpt + "' ";
if(Truck != "")
tmpSQL += "And c.truck_no='" + Truck + "' ";
if(GoodsNo != "")
tmpSQL = "And a.TO_NO='" + GoodsNo + "' "; // only by goods no query . ignore other condition

if(tmpSQL!="")
tmpSQL = " Where " + tmpSQL.Substring(3,tmpSQL.Length-3);

SQL = "Select a.to_no,a.goods_type,a.material_code,a.input_user,convert(varchar,a.input_time,01) + ' ' + convert(varchar,a.input_time,108) input_time,a.exel_acceptor line_acceptor,a.to_count,convert(varchar,c.transfer_time,01) + ' ' + convert(varchar,c.transfer_time,108) transfer_time,c.truck_no,c.nokia_guard,c.exel_acceptor trans_acceptor,case c.truck_status when '0' then 'Loadding' else 'Loadded' end " +
"From FG_TO_list a left join FG_Trans_Details b " +
"On a.TO_no=b.TO_no inner join FG_Trans_Info c On b.trans_id=c.trans_id and a.material_code=b.material_code ";


SQL += tmpSQL + " Order by a.input_time desc";

dSet=new DataSet();
adapter=new SqlDataAdapter(SQL,conn);
adapter.Fill(dSet,"TO");
return dSet;
}
private void DowdDropList_SelectChanged(o,e)
{
Response.Write("<script>parent.frames['框架另一页的名称'].reload();</script>");
//或者用Page.RegisterStartupScript( )
}
2.分开语句
sql=""
+"";
看到一代码:
public DataSet GoodsInfo(string timeFrom,string timeTO,string GoodsType,string GoodsNo,string lineUser,string lineAcpt,string Material,string lineID,string Guard,string transAcpt,string Truck)
{
string SQL,tmpSQL;
System.Data.DataSet dSet;
System.Data.SqlClient.SqlDataAdapter adapter;
tmpSQL = "";
if(timeFrom!=""&timeTO!="")
{
tmpSQL += "And a.input_time >='" + timeFrom + "' And a.input_time <= '" + timeTO + "' ";
}
if(GoodsType != ""&&GoodsType != "All")
tmpSQL += "And a.Goods_Type = '" + GoodsType + "' ";
if(lineUser != "")
tmpSQL += "And a.input_user='" + lineUser + "' ";
if(lineAcpt != "")
tmpSQL += "And a.exel_acceptor='" + lineAcpt + "' ";
if(Material != "")
tmpSQL += "And a.Material_code='" + Material + "' ";
if(lineID != "")
tmpSQL += "And a.line_id IN (" + lineID + ") ";
if(Guard != "")
tmpSQL += "And c.nokia_guard='" + Guard + "' ";
if(transAcpt != "")
tmpSQL += "And c.exel_acceptor='" + transAcpt + "' ";
if(Truck != "")
tmpSQL += "And c.truck_no='" + Truck + "' ";
if(GoodsNo != "")
tmpSQL = "And a.TO_NO='" + GoodsNo + "' "; // only by goods no query . ignore other condition
if(tmpSQL!="")
tmpSQL = " Where " + tmpSQL.Substring(3,tmpSQL.Length-3);
SQL = "Select a.to_no,a.goods_type,a.material_code,a.input_user,convert(varchar,a.input_time,01) + ' ' + convert(varchar,a.input_time,108) input_time,a.exel_acceptor line_acceptor,a.to_count,convert(varchar,c.transfer_time,01) + ' ' + convert(varchar,c.transfer_time,108) transfer_time,c.truck_no,c.nokia_guard,c.exel_acceptor trans_acceptor,case c.truck_status when '0' then 'Loadding' else 'Loadded' end " +
"From FG_TO_list a left join FG_Trans_Details b " +
"On a.TO_no=b.TO_no inner join FG_Trans_Info c On b.trans_id=c.trans_id and a.material_code=b.material_code ";

SQL += tmpSQL + " Order by a.input_time desc";
dSet=new DataSet();
adapter=new SqlDataAdapter(SQL,conn);
adapter.Fill(dSet,"TO");
return dSet;
}

浙公网安备 33010602011771号