string sql = "select '请选择产品类型查询' as ProType union all select distinct ProType from tb_Parts";
ddlsProType.DataSource = db.ds(sql);
ddlsProType.DataValueField = "ProType";
ddlsProType.DataTextField = "ProType";
ddlsProType.DataBind();
复制代码
try
{
string sql = "select a.ID,a.ProType,b.CmpCode,a.PartID,a.PartName,c.PartClass,d.PartDepSort,a.PlanPrice,e.Storehouse,a.IsUse,f.UserName as AddUser,a.AddDate,g.UserName as ModUser,a.ModDate from tb_Parts as a left join tb_CmpCode as b on a.CmpCodeID=b.CmpCodeID left join tb_PartClass as c on a.PartClassID=c.PartClassID left join tb_PartDepSort as d on a.PartDepSortID=d.PartDepSortID left join tb_Storehouse as e on a.StorehouseID=e.StorehouseID left join tb_UserInfo as f on a.AddUserID=f.UserID left join tb_UserInfo as g on a.ModUserID=g.UserID where a.ProType='" + ddlsProType.SelectedItem.Text + "'";