我在其他页面用session传过来一组值。那么怎样把他们变为参数呢?代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
this.BindtoDatagrid();
}
}
void BindtoDatagrid()
{
ArrayList al=(ArrayList)Session["id"];
for(int i=0;i<al.Count;i++)
{
//Response.Write(al[i]);
}
OleDbConnection myConn = new OleDbConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
myConn.Open();
OleDbDataAdapter sad=new OleDbDataAdapter();
sad.SelectCommand=new OleDbCommand("Select * from ItemMaster where GOODMEM= ",myConn);
DataSet tt=new DataSet();
sad.Fill(tt,"emp");
this.dgpick.DataSource=tt.Tables["emp"];
this.dgpick.DataBind(); }
想把这组数据给GOODMEM这个参数该怎样写呢?
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
this.BindtoDatagrid();
}
}
void BindtoDatagrid()
{
ArrayList al=(ArrayList)Session["id"];
for(int i=0;i<al.Count;i++)
{
//Response.Write(al[i]);
}
OleDbConnection myConn = new OleDbConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
myConn.Open();
OleDbDataAdapter sad=new OleDbDataAdapter();
sad.SelectCommand=new OleDbCommand("Select * from ItemMaster where GOODMEM= ",myConn);
DataSet tt=new DataSet();
sad.Fill(tt,"emp");
this.dgpick.DataSource=tt.Tables["emp"];
this.dgpick.DataBind(); }
想把这组数据给GOODMEM这个参数该怎样写呢?
解决方案 »
- 有哪些方法可以获取当前页的网址,而不包含?后的数据?
- gridview控件接收存储过程返回参数的问
- 为什么没有显示结果
- 两数据库中的两个表的记录怎样实现同步?
- 请问大家媒体点播的网站,需要实现那些功能,或提供已做过的网站。谢谢大家
- 请教如何把Image中的图片存入access中?
- 很久没有遇到这么棘手的问题了,关于从数据库读“二进制流”图片,绑定到DataGrid中的<img src="images?id=<% # Da......
- 救命啊。帮帮忙啊。有大奖啊。
- 请教一个问题
- 在线等待[马上结分]:用SqlDataReader怎么得到一个查询语句的记录数?
- 怎样实现记录分页?
- 1000分求一套.net的开发框架
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int i = 0; i < al.Count; i++)
sb.Append("'"+al[i]+"',");//.........
//......... sad.SelectCommand = new OleDbCommand("Select * from ItemMaster where GOODMEM in ("+sb.ToString().TrimEnd(",".ToCharArray())+") ", myConn);
都OK了,多谢!!: )