The following code sample shows how to parse QueryString Values into Dataset
//declaring a string array
string[] strArrQuerystring;
strArrQuerystring=new string[Request.QueryString.AllKeys.Length];
//getting the query string values into string array
for (int i = 0; i <>
{
strArrQuerystring[i] = Request.QueryString.Keys[i].ToUpper() + "," + Request.QueryString.GetValues(i)[0].ToString();
}
//getting the query string values into dataset
DataSet dsQueryString =QueryStringParser(strArrQuerystring);
public DataSet QueryStringParser(string[] strArrayQueryString)
{
DataSet dsInputs = new DataSet();
DataTable dtInputs = new DataTable();
DataColumn dcColumn = null;
for (int i = 0; i <>
{
dcColumn = new DataColumn(strArrayQueryString[i].Split(',')[0].ToUpper());
dtInputs.Columns.Add(dcColumn);
}
DataRow drInputs = dtInputs.NewRow();
for (int j = 0; j <>
{
drInputs[j] = strArrayQueryString[j].Split(',')[1].ToString();
}
dtInputs.Rows.Add(drInputs);
dsInputs.Tables.Add(dtInputs);
return dsInputs;
}
For Answers, see/post comments
Parse QueryString Values into Dataset
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment