📄 querygoodsform.aspx.cs
字号:
//文件名:QueryGoodsForm.aspx.cs
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;
using System.Data.SqlClient;
public partial class QueryManage_QueryGoodsForm : System.Web.UI.Page
{
private static string MySQL = "";
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("D2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询菜品信息
string My菜品大类 = this.DropDownList1.SelectedValue.ToString();
if (My菜品大类 == "所有")
My菜品大类 = "%%";
string My菜品小类 = this.DropDownList2.SelectedValue.ToString();
if (My菜品小类 == "所有")
My菜品小类 = "%%";
string My菜品风味 = this.DropDownList3.SelectedValue.ToString();
if (My菜品风味 == "所有")
My菜品风味 = "%%";
string My当前状态 = this.DropDownList4.SelectedValue.ToString();
if (My当前状态 == "所有")
My当前状态 = "%%";
DataTable MyTable = new DataTable();
MySQL = "SELECT * From 菜品信息 WHERE (菜品大类 LIKE '%" + My菜品大类 + "%')";
MySQL += "AND (菜品小类 LIKE '%" + My菜品小类 + "%')";
MySQL += "AND (菜品风味 LIKE '%" + My菜品风味 + "%')";
MySQL += "AND (当前状态 LIKE '%" + My当前状态 + "%')";
MySQL += "AND (菜品名称 LIKE '%" +this.TextBox5.Text + "%')";
MySQL += "AND (计费单价 BETWEEN " + this.TextBox6.Text + " AND " + this.TextBox7.Text + ") ";
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyEateryDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.GridView1.DataSource = MyTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印菜品信息
Server.Transfer("~/QueryManage/QueryGoodsPrint.aspx");
}
public string MyPrintSQL
{//设置要传递到打印页的数据
get
{
return MySQL;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -