.net Datalist 控件 接受数据问题 System.Data.OleDb.OleDbException: 标准表达式中数据类型不匹配
首页:<tdalign="center"colspan="2"><ahref="zhanshi.aspx?ID=<%#DataBinder.Eval(Container....
首页: <td align="center" colspan="2" > <a href="zhanshi.aspx?ID=<%#DataBinder.Eval(Container.DataItem,"ID") %>" ><%#DataBinder.Eval(Container.DataItem,"name") %></a></td>
接受页:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string id = this.Request.QueryString["ID"];
OleDbConnection con = DB.createDB();
con.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = con;
cmd.CommandText = "select * from tb_cpl where ID='" + ID + "'";
cmd.ExecuteNonQuery();
OleDbDataReader sdr = cmd.ExecuteReader();
sdr.Read();
this.Label7.Text = sdr.GetString(9).ToString();
sdr.Close();
con.Close();
}
ID 自动编码型 name 文本型
救救我吧!
string id = this.Request.QueryString["ID"];
id写错啦 还是有问题 展开
接受页:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string id = this.Request.QueryString["ID"];
OleDbConnection con = DB.createDB();
con.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = con;
cmd.CommandText = "select * from tb_cpl where ID='" + ID + "'";
cmd.ExecuteNonQuery();
OleDbDataReader sdr = cmd.ExecuteReader();
sdr.Read();
this.Label7.Text = sdr.GetString(9).ToString();
sdr.Close();
con.Close();
}
ID 自动编码型 name 文本型
救救我吧!
string id = this.Request.QueryString["ID"];
id写错啦 还是有问题 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询