Q:abute varible & Query Builder in stimulsoft

Stimulsoft Reports.WEB discussion
showki
Posts: 8
Joined: Sat Feb 19, 2011 11:12 pm
Location: ksa

Q:abute varible & Query Builder in stimulsoft

Post by showki »

Hello all

please provide me a sample for passing a parameter of type datetime to the stimulsoft report, i am using the query in the .mrt file itself.

I am able to pass variable as parameter to .mrt file, it is working for all data type exept datetime.


Thanks in advanced
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Q:abute varible & Query Builder in stimulsoft

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

DateTime dTime = new DateTime(2010, 02, 21);
report.Dictionary.Variables["DateTimeVariable1"].ValueObject = dTime;
Thank you.
showki
Posts: 8
Joined: Sat Feb 19, 2011 11:12 pm
Location: ksa

Q:abute varible & Query Builder in stimulsoft

Post by showki »

Hello

Thank you Aleksey for you reply.

I want query that make me able to pass datetime variable from stimulsoft to sqlserver.


Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Q:abute varible & Query Builder in stimulsoft

Post by Alex K. »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
showki
Posts: 8
Joined: Sat Feb 19, 2011 11:12 pm
Location: ksa

Q:abute varible & Query Builder in stimulsoft

Post by showki »

ok thank you

I use this's function from asp to report stimulsoft

private void DisplayReport()
{
if (Request.QueryString["ReportName"] != null)
{
reportName = Convert.ToString(Request.QueryString["ReportName"]);

}
else
{
return;
}



lblSelectedreport.Text = reportName;


Session["Reportdt"] = (DataTable)dt;

string reportPath = Server.MapPath(@"./Reports/") + reportName;

Session["ReportPath"] = reportPath;

StiReport report = new StiReport();

report.Load(Server.MapPath(@"./Reports/") + reportName);
report.Dictionary.Databases.Clear();

string connectionString = ConfigurationManager.ConnectionStrings["constring"].ConnectionString.ToString();
report.Dictionary.Databases.Add(new StiSqlDatabase("Connection", connectionString));

((StiText)report.Pages["Page1"].GetComponents()["Variable1"]).Text.Value = txtStartdate.Text;
((StiText)report.Pages["Page1"].GetComponents()["Variable2"]).Text.Value = txtExpirydate.Text;


report.Compile();

StiWebViewer1.Report = report;
}


I want to use the query between (Variable1 and Variable2) in the stimulsoft
Thanks again
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Q:abute varible & Query Builder in stimulsoft

Post by Alex K. »

Hello,

If we understood your question correctly, you can create 2 variables in a report, which are used in the query

Code: Select all

SELECT * FROM TABLE WHERE COLUMN BETWEEN {Variable1} AND {Variable2}
And pass values of these variables from the code

Code: Select all

report["Variable1"] = value;
Thank you.
showki
Posts: 8
Joined: Sat Feb 19, 2011 11:12 pm
Location: ksa

Q:abute varible & Query Builder in stimulsoft

Post by showki »

Thank you very much
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Q:abute varible & Query Builder in stimulsoft

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
showki
Posts: 8
Joined: Sat Feb 19, 2011 11:12 pm
Location: ksa

Q:abute varible & Query Builder in stimulsoft

Post by showki »

Hello Aleksey
I am pleased and honored your interlocutor again

I ask forgiveness and a big thanks to you from me
Can send an example to display the data between two dates, because I tried to Carry out the code I can not
I've got two dates I do first of the program and then I send dates to the report and there is data is displayed depending on the dates sent
Please send example fully
Wait for your answer my teacher Mr.

Note
I am use a language asp and charp
thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Q:abute varible & Query Builder in stimulsoft

Post by Alex K. »

Hello,

When you use the DateTime type in the query with the Between construction, the date should be in the 'YYYYMMDD' format. Otherwise, you need to write a converter that will convert the date to your desired format.

Thank you.
Post Reply