110,535
社区成员
发帖
与我相关
我的任务
分享
string id = Request.Cookies["id"].Value;
//access 数据源控件的SelectCommand的后台绑定.
AccessDataSrc.SelectCommand = "select * from [t_man] where [id]=@id";
AccessDataSrc.SelectParameters.Clear(); //清除可能已有选择参数.
AccessDataSrc.SelectParameters.Add("id", TypeCode.Int32, id);
AccessDataSrc.DataBind();
string name = txtName.Text.Trim();
AccessDataSrc.SelectCommand = "select * from [t_man] where [name] like '%@name%'";
AccessDataSrc.SelectParameters.Clear(); //清除可能已有选择参数.
AccessDataSrc.SelectParameters.Add("@name", TypeCode.String, name);
AccessDataSrc.DataBind();
string name = txtName.Text.Trim();
AccessDataSrc.SelectCommand = "select * from [t_man] where [name] like '%" +name + "%'";
AccessDataSrc.SelectParameters.Clear(); //清除可能已有选择参数.
AccessDataSrc.SelectParameters.Add("@name", TypeCode.String, name);
AccessDataSrc.DataBind();
AccessDataSrc.SelectCommand = "select * from [t_man] where [name] like %@name%";
的时候就报错.