Multiple values in a querystring
-
I am a noob working a webpage, i wanna pass multiple values from a select box in a query string so that a report may be generated any one can help me please. So basically, if the user enters only one value, only 1 report is queried if they entered more than 1 then more than one report is generated one after another. this is the code i already have, it only make one query to the database now. I want the reports to be created one below the other.... and so on.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace SealRegister
{
public partial class _Default : System.Web.UI.Page
{protected void Page\_Load(object sender, EventArgs e) { try { string connstring = @"Data Source=FGVMDEVSVR;Initial Catalog=FGBInvestment;uid=sa;pwd=Wizard1;"; //string connstring = @"Data Source=FGBMIS01\\SQLEX;Database=FGBInvestments;Trusted\_Connection=yes;User Id;Password="; SqlConnection conn = new SqlConnection(connstring); SqlCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp\_getTransfer"; //create parameters to provide the input SqlParameter parInput1 = cmd.Parameters.Add("@TRANSFER\_ID", SqlDbType.Int); parInput1.Direction = ParameterDirection.Input; parInput1.Value = Request.QueryString\["TRANSFER\_ID"\]; //execute stored procedure conn.Open(); SqlDataReader dtaReader; dtaReader = cmd.ExecuteReader(); while (dtaReader.Read()) { //Associate service fields names and types from database to elements in smsValues array lblIMID.Text = Convert.ToString(dtaReader\["IMID"\]); lblDESCRIPTION.Text = Convert.ToString(dtaReader\["DESCRIPTION"\]); lblAMOUNT.Text = Convert.ToString(dtaReader\["AMOUNT"\]); lblAMOUNT\_TRANSFER.Text = Convert.ToString(dtaReader\["AMOUNT\_TRANSFER"\]); lblCONSIDERATION.Text = Convert.ToString(dtaReader\["CONSIDERATION"\]); lblCURR.Text = Convert.ToString(dtaReader\["CURR"\]); lblCons\_Curr.Text = Convert.ToString(dtaReader\[
-
I am a noob working a webpage, i wanna pass multiple values from a select box in a query string so that a report may be generated any one can help me please. So basically, if the user enters only one value, only 1 report is queried if they entered more than 1 then more than one report is generated one after another. this is the code i already have, it only make one query to the database now. I want the reports to be created one below the other.... and so on.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;namespace SealRegister
{
public partial class _Default : System.Web.UI.Page
{protected void Page\_Load(object sender, EventArgs e) { try { string connstring = @"Data Source=FGVMDEVSVR;Initial Catalog=FGBInvestment;uid=sa;pwd=Wizard1;"; //string connstring = @"Data Source=FGBMIS01\\SQLEX;Database=FGBInvestments;Trusted\_Connection=yes;User Id;Password="; SqlConnection conn = new SqlConnection(connstring); SqlCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp\_getTransfer"; //create parameters to provide the input SqlParameter parInput1 = cmd.Parameters.Add("@TRANSFER\_ID", SqlDbType.Int); parInput1.Direction = ParameterDirection.Input; parInput1.Value = Request.QueryString\["TRANSFER\_ID"\]; //execute stored procedure conn.Open(); SqlDataReader dtaReader; dtaReader = cmd.ExecuteReader(); while (dtaReader.Read()) { //Associate service fields names and types from database to elements in smsValues array lblIMID.Text = Convert.ToString(dtaReader\["IMID"\]); lblDESCRIPTION.Text = Convert.ToString(dtaReader\["DESCRIPTION"\]); lblAMOUNT.Text = Convert.ToString(dtaReader\["AMOUNT"\]); lblAMOUNT\_TRANSFER.Text = Convert.ToString(dtaReader\["AMOUNT\_TRANSFER"\]); lblCONSIDERATION.Text = Convert.ToString(dtaReader\["CONSIDERATION"\]); lblCURR.Text = Convert.ToString(dtaReader\["CURR"\]); lblCons\_Curr.Text = Convert.ToString(dtaReader\[
ferronrsmith wrote:
So basically, if the user enters only one value, only 1 report is queried if they entered more than 1 then more than one report is generated one after another.
What do you mean report here?? Is it a crystal report? I dont see any report binding code. I would appreciate if you elaborate your requirement. Cheers, Sudhanva
-
ferronrsmith wrote:
So basically, if the user enters only one value, only 1 report is queried if they entered more than 1 then more than one report is generated one after another.
What do you mean report here?? Is it a crystal report? I dont see any report binding code. I would appreciate if you elaborate your requirement. Cheers, Sudhanva
i am cheap, can't afford crystal, lol. I wanna create a form that grabs data from a database and insert it in my layout, the problem i am having is that i want to grab multiple records from the database and display it. Three per page.
Ferron
-
i am cheap, can't afford crystal, lol. I wanna create a form that grabs data from a database and insert it in my layout, the problem i am having is that i want to grab multiple records from the database and display it. Three per page.
Ferron
ferronrsmith wrote:
I wanna create a form that grabs data from a database and insert it in my layout
Instead create a usercontrol (which should have your forms' controls) to bind the data, and put a
for
loop for number of querystring items, and call the usercontrol and bind the data. That should solve your problem. Cheers, Sudhanva