Passing parameters from stored procedure to FR

Hi.
Unfortunately noone answer to my previous topic, so im trying to create report from designer + VS2010.
Now I have another problem.
I have stored procedure, which takes 3 parameters: userID, dateFrom and dateTO.
In FR designer i created new connection like:
Data Source=(local);AttachDbFilename=;Initial Catalog=dbTest;Integrated Security=True;Persist Security Info=False;User ID=;Password=

and my sql query is :
IF 1=0 BEGIN
SET FMTONLY OFF
END
EXEC RaportFormPlatnosci
        @userID = @uID,
        @dateFrom = NULL,
        @dateTO = NULL

Now, in parameters definition i have added parameter (uID from query):
Name = uID,
DataType = Int,
DefaultValue = 0 (in stored procedure, when userID = 0 -> take all users, when >0 take user with id = x)
Expression = ,
Size = 0.


so my report properiets looks like:
88651655.png

Now in my WPF (using c#) application im trying to pass parameters for stored procedure:
using (Report newrep = new Report())
            {
                newrep.Load(@"C:\Users\Komputer-1\repfrx");
                newrep.SetParameterValue("@uID", 1);
                newrep.Refresh();
                newrep.Show();

            }

When im debugging i can see parameter.count = 1, with uID parameter and value = null.
after setparameter value i can see there value = 1, but still getting data for all users, not for userid = 1.

Please, can anyone help me with this issue?

Comments

  • edited 9:24AM
    Thanks for great support...
    Before I bought fast-report I used FREE Crystal reports for VS2010, with full-forum support. Seriously, I got answer for any question in about 2-3 hours after posting.
    But i decided to spend money on Fast-report, where i have no support...Yea well, there is tutorials, but cant see really anything interesting about WPF/C#.
    Even finding answer for very basic question - like passing parameters from stored procedure - is very, very hard.
  • edited 9:24AM
    I have never tried stored procedures in FastReport, only normal queries. But have you tried the following:
    In the definitions for the parameter you wrote this:

    Name = uID,
    DataType = Int,
    DefaultValue = 0 (in stored procedure, when userID = 0 -> take all users, when >0 take user with id = x)
    Expression = ,
    Size = 0.

    Try to set the value for expression to the parameter of the report you have specified under "Parametry". When you click into the expression field, there should appear an icon indicating a menu. Click on it. You can then select your parameter. It will probably be written as [uID] into the expression field.

    I had my problems with parameters in queries as well that suddenly disappeared. But you do actually need to fill out the field for expression. Otherwise FastReport cannot know that you want to access this parameter.



    By the way, yes, the support in this forum is sadly pretty much non existant and the documentation often doesn't help. Look at all the other threads with no answers. I had to experience it myself. I wasted around 2 days for a problem that could have been solved in 15 minutes if I had known the right property of an object.
  • edited 9:24AM
    equi wrote: »
    I have never tried stored procedures in FastReport, only normal queries. But have you tried the following:
    In the definitions for the parameter you wrote this:

    Name = uID,
    DataType = Int,
    DefaultValue = 0 (in stored procedure, when userID = 0 -> take all users, when >0 take user with id = x)
    Expression = ,
    Size = 0.

    Try to set the value for expression to the parameter of the report you have specified under "Parametry". When you click into the expression field, there should appear an icon indicating a menu. Click on it. You can then select your parameter. It will probably be written as [uID] into the expression field.

    I had my problems with parameters in queries as well that suddenly disappeared. But you do actually need to fill out the field for expression. Otherwise FastReport cannot know that you want to access this parameter.



    By the way, yes, the support in this forum is sadly pretty much non existant and the documentation often doesn't help. Look at all the other threads with no answers. I had to experience it myself. I wasted around 2 days for a problem that could have been solved in 15 minutes if I had known the right property of an object.


    Thanks!
    First reply, and it helps..
    I needed to set Expression as just 1 for example, not like uID = 1, not like @uID = 1, simply 1 ( in parameter expression) - so in code its like
    setparametervalue("uID",1);
    in database expression i put userid = uID and it works now.

    Well, maybe i wont resign from fr after all...

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.