|
Location of stored procedure:
http://www.cnblogs.com/hertcloud/archive/2005/12/21/301327.html
My code:
SqlConnection cnn = new SqlConnection (ConfigurationSettings.AppSettings ["ConnectionString"]);
SqlCommand _comm = new SqlCommand ("proc_ListPageInt", cnn);
_comm.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = null;
_comm.Parameters.Add ("@ tblName", SqlDbType.NVarChar, 200);
_comm.Parameters ["@ tblName"]. Value = "info_public";
_comm.Parameters.Add ("@ fldName", SqlDbType.NVarChar, 500);
_comm.Parameters ["@ fldName"]. Value = "*";
_comm.Parameters.Add ("@ pageSize", SqlDbType.Int);
_comm.Parameters ["@ pageSize"]. Value = 5;
_comm.Parameters.Add ("@ page", SqlDbType.Int);
_comm.Parameters ["@ page"]. Value = 1;
_comm.Parameters.Add ("@ fldSort", SqlDbType.NVarChar, 200);
_comm.Parameters ["@ fldSort"]. Value = "infoid";
_comm.Parameters.Add ("@ Sort", SqlDbType.Bit);
_comm.Parameters ["@ Sort"]. Value = true;
_comm.Parameters.Add ("@ strCondition", SqlDbType.NVarChar, 1000);
_comm.Parameters ["@ strCondition"]. Value = "";
_comm.Parameters.Add ("@ ID", SqlDbType.NVarChar, 150);
_comm.Parameters ["@ ID"]. Value = "infoid";
_comm.Parameters.Add ("@ Counts", SqlDbType.Int, 0);
_comm.Parameters ["@ Counts"]. Direction = ParameterDirection.Output;
_comm.Parameters.Add ("@ pageCount", SqlDbType.Int, 0);
_comm.Parameters ["@ pageCount"]. Direction = ParameterDirection.Output;
cnn.Open ();
dr = _comm.ExecuteReader ();
//dr.Read();//There is no value if it is not the same!
string gdds = "ff";
gdds = (string) _comm.Parameters ["@ Counts"]. Value;
Response.Write (gdds); // Nothing is output on the web page!
dr has a value, but out int counts, out int pageCounts cannot take values
It's 80 points, all given! ~ |
|