日期:2014-05-18 浏览次数:20946 次
        public static DataTable GetTable(String p_Sql, SqlParameter[] p_ParaList, CommandType p_Type)
        {
            SqlCommand command = CreateCommand(p_Sql, p_ParaList, p_Type);//创建Command对象
            Debug.Assert(null != command);            //只要语句不是空值
            SqlConnection conn = new SqlConnection(strConn);//创建连接
            command.Connection = conn;//设置连接
            SqlDataAdapter adapter = new SqlDataAdapter(command);//这里面是SQL语句
            DataTable table = new DataTable();//创建表
            adapter.Fill(table);//将查询结果赋给表
            return table;//返回
        }