日期:2014-05-18 浏览次数:20769 次
public static SqlDataReader ExeDr(CommandType Tyle, string SqlStr, params SqlParameter[] parameters) { SqlCommand ComDr = GetCommand(Tyle, SqlStr, parameters); SqlDataReader Dr = ComDr.ExecuteReader(CommandBehavior.CloseConnection); ComDr.Parameters.Clear(); return Dr; } SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@tbName", SqlDbType.VarChar, 255), new SqlParameter("@tbFields", SqlDbType.VarChar, 1000), new SqlParameter("@OrderField", SqlDbType.VarChar, 255), new SqlParameter("@PrimaryField", SqlDbType.VarChar, 255), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@PageIndex", SqlDbType.Int), new SqlParameter("@OrderType", SqlDbType.Bit), new SqlParameter("@strWhere", SqlDbType.VarChar, 1500), new SqlParameter("@Total", SqlDbType.Int), }; parms[0].Value = "Company"; parms[1].Value = "Id,CompanyName"; parms[2].Value = "AddTime"; parms[3].Value = "Id"; parms[4].Value = PageSize; parms[5].Value = PageIndex; parms[6].Value = 0; parms[7].Value = "State=1"; parms[8].Direction = ParameterDirection.Output; Total = (int)parms[8].Value;//////////////////******这里出错******/////////////// SqlDataReader Dr = Rsyll.DAL.SqlHelper.ExeDr(CommandType.StoredProcedure, "SqlDataPaging", parms); while (Dr.Read()) { Company_Model One = ReturnCompanyDemo(Dr); List.Add(One); //Total = (int)Dr[0]; } Dr.Close(); Dr.Dispose(); return List;