private void fyDB()
{
DataTable dt = new DataTable();
string con = ["connectionstring"];
SqlConnection conn = new SqlConnection(con);
SqlCommand comm = new SqlCommand("P_viewPage_A", conn); //Create SqlCommand object
= ; //Set the execution type of the SqlCommand object to a stored procedure
("@TableName", ,200); //Add parameters to the Parameters parameter list
("@FieldList", , 2000);
("@PrimaryKey", , 100);
("@where", , 2000);
("@Order", , 1000);
("@SortType", );
("@RecorderCount", );
("@PageSize", );
("@PageIndex", );
("@TotalCount", );
("@TotalPageCount", );
["@TotalCount"].Direction = ; //Set the output type of the parameter
["@TotalPageCount"].Direction = ; //Set the output type of the parameter
["@TableName"].Value = "type1";//Table name
["@FieldList"].Value = "*";//Show column names, if all fields are *
["@PrimaryKey"].Value = "id";//Single primary key or unique value key
["@where"].Value = "";//Query condition does not contain 'where' character, such as id>10 and len(userid)>9
["@Order"].Value = "id asc";//Sort Not containing the 'order by' character, such as id asc, userid desc, asc or desc must be specified
["@SortType"].Value = 1;//Sorting rules 1: positive order asc 2: reverse order desc 3: multi-column sorting method
["@RecorderCount"].Value = 0;//Total number of records 0: The total record will be returned
["@PageSize"].Value = 2;//Number of records output per page
int id1;
if (["id"] == null)
id1 = 1;
else
id1 = Convert.ToInt32(["id"]);
["@PageIndex"].Value = id1;//Current page count
();
// SqlDataReader asr = ();
//int dtr = (int)();
SqlDataReader sdr = ();
int i=0;
//while (())
//{
// [i][0] = (0);
// [i][1] = (1);
//}
dt = ConvertDataReaderToDataTable(sdr);
= dt;
();
// [0][0];
();
// (dtr);
(["@TotalCount"].Value + "<br>");
(["@TotalPageCount"].Value + "<br>");
// if((Int32)["RETURN_VALUE"].Value==0)
();
//string conStr = ["connectionstring"];
//SqlConnection connection = new SqlConnection(conStr);
//DataSet dataSet = new DataSet();
//();
//SqlDataAdapter sqlDA = new SqlDataAdapter();
// = BuildQueryCommand(connection, "P_viewPage_A", parameters);
//(dataSet, tableName);
//();
//return dataSet;
}
#region Convert DataReader to DataTable
/// <summary>
/// Convert DataReader to DataTable
/// </summary>
/// <param name="DataReader">DataReader</param>
public static DataTable ConvertDataReaderToDataTable(SqlDataReader reader)
{
try
{
DataTable objDataTable = new DataTable();
int intFieldCount = ;
for (int intCounter = 0; intCounter < intFieldCount; ++intCounter)
{
((intCounter), (intCounter));
}
();
object[] objValues = new object[intFieldCount];
while (())
{
(objValues);
(objValues, true);
}
();
();
return objDataTable;
}
catch (Exception ex)
{
throw new Exception("Error in converting DataReader to DataTable!", ex);
}
}
#endregion