62,269
社区成员
发帖
与我相关
我的任务
分享
sqlText = "select * from users where 字段1='" + ddl + "' and 字段二='" + ttb + "'";
switch (A)
{
case "tudi_add":
sqlText = "select * from tudi where tudi_add =" + B;
break;
case "tudi_num":
sqlText = "select * from tudi where tudi_num =" + B;
break;
case "tudi_use":
sqlText = "select * from tudi where tudi_use =" + B;
break;
default:
break;
}
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" + Server.MapPath("~/img/halu_nw.mdb");
OleDbConnection con = new OleDbConnection(strCon);
con.Open();
OleDbDataAdapter dbAdapter = new OleDbDataAdapter(sQueryString, conn);
DataSet ds = new DataSet();
dbAdapter.Fill(ds, "tudi ");
GridView1.DataSource = ds.Table[0].DefultView;
GridView1.DataBind;
conn.Close();
private void Button1_Click(object sender, System.EventArgs e)
{
session[id]= this.DropDownList1.SelectedValue;
session[content]= this.TextBox1.Text;
Response.Redirect("B.aspx");
}
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["id"].ToString();
string content = Request.QueryString["content"].ToString();
}
}
protected void btn_Click(object sender, EventArgs e)
{
string a = DropDownList1.SeleclValue;
string b = TextBox1.Text;
string up = String.Format("b.aspx?a={0}&b={1}",a,b);
Response.Redirect(up, true);
}string a = "";
string b = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request["a"]))
a = Request["a"];
if (!string.IsNullOrEmpty(Request["a"]))
b = Request["b"];
if(!IsPostBack)
{
string sql = "select * from [表名]";
if( a != "" && b != "")
{
sql += string.Format("where {0} = {1}",a,b);
}
.....
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect("B.aspx?id="+this.DropDownList1.SelectedValue+"&content="+this.TextBox1.Text);
}
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["id"].ToString();
string content = Request.QueryString["content"].ToString();
}
}