📄 mybuy.aspx.cs
字号:
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
DataGrid3.DataBind();
}
}
else
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlConnection conn = new SqlConnection(ec);
conn.Open();
SqlCommand cmd =
new SqlCommand( "SELECT * FROM commdotyInfo WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='0'", conn );
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
dr.Close();
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and catid='"+DropDownList1.SelectedValue+"' and status='1' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='0",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
DataGrid3.DataBind();
}
}
}
}
else
{
if(RadioButtonList1.SelectedIndex==-1)
{
SqlConnection conn = new SqlConnection(ec);
conn.Open();
SqlCommand cmd =
new SqlCommand( "SELECT * FROM commdotyInfo WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"'", conn );
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
dr.Close();
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" where comName like '%"+TextBox3.Text+"%' and catid='"+DropDownList1.SelectedValue+"' and status='1' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='1'"+
"union select commodityID,comName,catID,cat_secID,price,img,'拍卖' as deal_auction,userid "+
"from commdotyInfo where comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='0'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
DataGrid3.DataBind();
}
}
else
{
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlConnection conn = new SqlConnection(ec);
conn.Open();
SqlCommand cmd =
new SqlCommand( "SELECT * FROM commdotyInfo WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='1'", conn );
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
dr.Close();
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='1'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
DataGrid3.DataBind();
}
}
else
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlConnection conn = new SqlConnection(ec);
conn.Open();
SqlCommand cmd =
new SqlCommand( "SELECT * FROM commdotyInfo WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='0'", conn );
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
dr.Close();
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='0",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
DataGrid3.DataBind();
}
}
}
}
}
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string ec=System.Configuration.ConfigurationSettings.AppSettings["ec"];
Session["catnm"]=DropDownList1.SelectedItem.ToString();
SqlConnection conn = new SqlConnection(ec);
conn.Open();
SqlDataAdapter daa=new SqlDataAdapter("SELECT * FROM category_sec "+
"where cat_ID=(select catid from category_first "+
"where catname='"+Session["catnm"]+"')", conn );DataSet dss=new DataSet();
daa.Fill(dss);
DropDownList2.DataSource=dss.Tables[0].DefaultView;
DropDownList2.DataTextField= "cat_secName";
DropDownList2.DataValueField="cat_secID";
DropDownList2.DataBind();
}
private void DataGrid3_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid3.CurrentPageIndex=e.NewPageIndex;
string ec=System.Configuration.ConfigurationSettings.AppSettings["ec"];
SqlConnection conn = new SqlConnection(ec);
conn.Open();
if(TextBox2.Text!="")
{
if(RadioButtonList1.SelectedIndex==-1)
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" where comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='1'"+
"union select commodityID,comName,catID,cat_secID,price,img,'拍卖' as deal_auction,userid "+
"from commdotyInfo where comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='0'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
else
{
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='1'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
else
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and '"+TextBox1.Text+"'<price and price<'"+TextBox2.Text+"' and deal_auction='0",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
}
}
else
{
if(RadioButtonList1.SelectedIndex==-1)
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" where comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='1'"+
"union select commodityID,comName,catID,cat_secID,price,img,'拍卖' as deal_auction,userid "+
"from commdotyInfo where comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='0'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
else
{
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='1'",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
else
if(RadioButtonList1.SelectedItem.Value=="1")
{
SqlDataAdapter da1=new SqlDataAdapter("select commodityID,comName,catID,cat_secID,price,img,'一口价' as deal_auction,userid from commdotyInfo"+
" WHERE comName like '%"+TextBox3.Text+"%' and status='1' and catid='"+DropDownList1.SelectedValue+"' and cat_secid='"+DropDownList2.SelectedValue+"' and deal_auction='0",conn);
DataSet ds1=new DataSet();
da1.Fill(ds1);
DataGrid3.DataSource=ds1;
}
}
}
DataGrid3.DataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -