namespace showpro { /// <summary> /// showcp 的摘要说明。 /// </summary> public class showcp : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList DropDownList1; public int t=2; public DataRow dr; public DataSet ds=new DataSet(); public DataSet ds1=new DataSet();
OleDbConnection myConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand=new OleDbDataAdapter("select * from aa WHERE typeid="+Request["typeid"]+" order by shijian desc", myConnection); DataSet ds= new DataSet(); myCommand.Fill(ds,"aa"); DropDownList1.DataSource = ds.Tables["aa"].DefaultView; DropDownList1.DataTextField = "biaoti"; DropDownList1.DataValueField ="id"; DropDownList1.DataBind(); DataBind();
if(!IsPostBack) {
OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * from aa WHERE typeid="+t+" order by shijian desc ", MyConnection); DataSet ds1 = new DataSet(); myCommand1.Fill(ds1, "aa"); dr = ds1.Tables["aa"].Rows[0]; } } public string FormatString(string str) { str=str.Replace(" "," "); str=str.Replace("<","<"); str=str.Replace(">",">"); str=str.Replace('\n'.ToString(),"<br>"); return str; } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand1 = new OleDbDataAdapter("select * from aa WHERE id="+DropDownList1.SelectedItem.Value+" ", MyConnection);
DataSet ds1 = new DataSet(); myCommand1.Fill(ds1, "aa"); dr = ds1.Tables["aa"].Rows[0]; } } }我还是看不出来啊!
------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;namespace showpro {
public class showcp : System.Web.UI.Page { public System.Web.UI.WebControls.DropDownList DropDownList1; public int t=2; public DataRow dr; public DataSet ds=new DataSet(); public DataSet ds1=new DataSet();
OleDbConnection myConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand=new OleDbDataAdapter("select * from aa WHERE typeid="+Request["typeid"]+" order by shijian desc", myConnection); DataSet ds= new DataSet(); myCommand.Fill(ds,"aa"); DropDownList1.DataSource = ds.Tables["aa"].DefaultView; DropDownList1.DataTextField = "biaoti"; DropDownList1.DataValueField ="id"; DropDownList1.DataBind(); DataBind();
OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * from aa WHERE typeid="+t+" order by shijian desc ", MyConnection); DataSet ds1 = new DataSet(); myCommand1.Fill(ds1, "aa"); dr = ds1.Tables["aa"].Rows[0]; } else{ OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb")); OleDbDataAdapter myCommand1 = new OleDbDataAdapter("select * from aa WHERE id="+DropDownList1.SelectedItem.Value+" ", MyConnection); DataSet ds1 = new DataSet(); myCommand1.Fill(ds1, "aa"); dr = ds1.Tables["aa"].Rows[0];
{
/// <summary>
/// showcp 的摘要说明。
/// </summary>
public class showcp : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
public int t=2;
public DataRow dr;
public DataSet ds=new DataSet();
public DataSet ds1=new DataSet();
private void Page_Load(object sender, System.EventArgs e)
{
OleDbConnection myConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand=new OleDbDataAdapter("select * from aa WHERE typeid="+Request["typeid"]+" order by shijian desc", myConnection);
DataSet ds= new DataSet();
myCommand.Fill(ds,"aa");
DropDownList1.DataSource = ds.Tables["aa"].DefaultView;
DropDownList1.DataTextField = "biaoti";
DropDownList1.DataValueField ="id";
DropDownList1.DataBind();
DataBind();
if(!IsPostBack)
{
OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * from aa WHERE typeid="+t+" order by shijian desc ", MyConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "aa");
dr = ds1.Tables["aa"].Rows[0]; }
}
public string FormatString(string str)
{
str=str.Replace(" "," ");
str=str.Replace("<","<");
str=str.Replace(">",">");
str=str.Replace('\n'.ToString(),"<br>");
return str;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand1 = new OleDbDataAdapter("select * from aa WHERE id="+DropDownList1.SelectedItem.Value+" ", MyConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "aa");
dr = ds1.Tables["aa"].Rows[0];
}
}
}我还是看不出来啊!
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace showpro
{
public class showcp : System.Web.UI.Page
{
public System.Web.UI.WebControls.DropDownList DropDownList1;
public int t=2;
public DataRow dr;
public DataSet ds=new DataSet();
public DataSet ds1=new DataSet();
private void Page_Load(object sender, System.EventArgs e)
{ if(!IsPostBack)
{
OleDbConnection myConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand=new OleDbDataAdapter("select * from aa WHERE typeid="+Request["typeid"]+" order by shijian desc", myConnection);
DataSet ds= new DataSet();
myCommand.Fill(ds,"aa");
DropDownList1.DataSource = ds.Tables["aa"].DefaultView;
DropDownList1.DataTextField = "biaoti";
DropDownList1.DataValueField ="id";
DropDownList1.DataBind();
DataBind();
OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand1 = new OleDbDataAdapter("SELECT * from aa WHERE typeid="+t+" order by shijian desc ", MyConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "aa");
dr = ds1.Tables["aa"].Rows[0]; }
else{ OleDbConnection MyConnection =new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("new.mdb"));
OleDbDataAdapter myCommand1 = new OleDbDataAdapter("select * from aa WHERE id="+DropDownList1.SelectedItem.Value+" ", MyConnection);
DataSet ds1 = new DataSet();
myCommand1.Fill(ds1, "aa");
dr = ds1.Tables["aa"].Rows[0];
} }
cnicq(最近比较烦) 问题解决的
我的错误错在哪里啊?