DataRow[] drs = dt.Select("ID_PatientExamDepart<>0");           for (int i = 0; i < drs.Length;i++ )
           //执行存储过程P_Patient_Fatch Patient ExamItems
           {
               //存储过程
               SqlConnection conn = new SqlConnection("Data Source=SERVER;........Integrated Security=false");               SqlDataAdapter da = new SqlDataAdapter();               da.SelectCommand = new SqlCommand();               DataSet ds = new DataSet();               da.SelectCommand.Connection = conn;               da.SelectCommand.CommandText = "存储过程名";               da.SelectCommand.CommandType = CommandType.StoredProcedure;               SqlParameter param = new SqlParameter("@ID_PatientExamDepart", SqlDbType.Int);               param.Direction = ParameterDirection.Input;               param.Value = drs[i][0];
                   
               da.SelectCommand.Parameters.Add(param);               da.Fill(ds);               this.Rpt.DataSource = ds;               this.Rpt.DataBind();
           }

解决方案 »

  1.   

    数据量不大的话 用VIEWSTATE来保存
      

  2.   

    只能把你返回出来的DataTable放在内存中了
      

  3.   

    在最PageLoad之外定义一个ViewState或者static类型的DataTable就行了
      

  4.   

    还是循环啊select xxxxx  in 语句不行么、如果非要这样循环每次在 da.Fill(ds);的时候累加ds (ds 在for循环外声明)下面那句拿到循环外  this.Rpt.DataSource = ds;  this.Rpt.DataBind();
      

  5.   


    对,就是想把几次出现的数据都绑定到repeater上!
      

  6.   

    那你直接在后台对这个DataTable的行进行累加不就行了,循环累加