日期:2014-05-17  浏览次数:20524 次

dataset转换数组
存储过程:
dbo.Web_GetNoticeAll
(
@SchoolID int
 )
AS
Select * from Tr_NewsInfo where Ne_Type = '实训通知'and SchoolID = @SchoolID order by Ne_Date DESC  
RETURN


DAL层

DataSet Web_GetNoticeAll(int schoolid);


 public DataSet Web_GetNoticeAll(int schoolid)
        {
            //定义数据公共访问基类对象
            SQLHelper helper = new SQLHelper();

            //定义参数集
            SqlParameter[] parms = {
                                              new SqlParameter ("@SchoolID",SqlDbType.Int)
            };
            parms[0].Value = schoolid;

            //执行公共的数据访问类中的ExecuteDataSet
            DataSet ds = helper.ExecuteDataSet("Web_GetNoticeAll", parms);
            return ds;

        }


BLL层

  public DataSet Web_GetNoticeAll(int schoolid)
        {
            TStudentInterface inotice = TStudentFactory.Create();
            return inotice.Web_GetNoticeAll(schoolid);
        }


后台:        
      [WebMethod(Description = "查看实训通知列表")]
        public DataSet GetNoticeAll(int schoolid)
        {
            TStudentBLL NoticeA = new TStudentBLL();
            string Tschoolid;
            Tschoolid =Convert.ToString ( schoolid);
            DataSet ds = NoticeA.Web_GetNoticeAll(Convert.ToInt32(schoolid));
            return ds;
        }



返回的是dataset  老师让我们返回数组 怎么改(没学过数组,网上的一些方法都看不懂)

------解决方案--------------------
 public DataSet 改为  public string[](字符串数组),函数中从数据集循环去数,然后写到数组
------解决方案--------------------
数组追加
List<Int32>&