Click here to Skip to main content
15,897,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

Guys i am totally a noob in vb
i want to create a report from a column named "Serial" in my dataset named "Serials" which shows me the data between 2 values (that i have given to it)
so far i have created a form.vb as my report viewer
i have created a report.rdlc as my report and added dataset and a table which shows all of "Serial" column data on it

now i just want to filter the data that it shows so i can only see data between my given values
{my values are two string which are label text}
i am familiar with sql syntax and i can run a query to get my values but i can not pass in into the report ...
my databases are accdb
tnx and sorry for my bad english
[[ added : i have not written any code for this. i just ran some wizards and created a report but my sql syntax in query builder looks like this :
SQL
SELECT   Serial
FROM    Serials
WHERE    Serial   BETWEEN   A  AND  B


]]
Posted
Updated 24-Jun-13 9:05am
v2
Comments
Nelek 24-Jun-13 11:40am    
You should post a bit of the relevant code involved, so people can see what are you trying and correct you // point you in a better direction

If so, please use the "improve question" widget and add the needed info

1 solution

You'll need to add parameters to your report. Your query will look more like this:

SQL
SELECT Serial FROM Serials WHERE Serial BETWEEN @A AND @B


Once you do that, you should add corresponding @A and @B parameters to the report definition (.rdlc). In Visual Studio, you'll generally see these in the "Report Data" docked window that shows you all of the parameters, fields, data sources, datasets, and images used in the report. Usually, if you type anything that even looks like a parameter name (starts with "@") into the query box of the report's dataset, it will automatically add them to the report parameters.

When running the report, you can set these either by using the MS Report Viewer parameter entry panel that shows up when there are non-hidden parameters, or you can set them programmatically.
 
Share this answer
 
Comments
KababChi 25-Jun-13 9:43am    
Your code generates sql syntax error ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900