ybt
asked on
ActiveReports with paramerters in C#
I placed SQL code in a datasource field of my report and
put the following code in ReportStart event
Parameter myParam1 = new Parameter();
myParam1.Key = user_id;
myParam1.Type = Parameter.DataType.String;
myParam1.PromptUser = false;
this.Parameters.Add(myPara m1);
But datasource does not receive parameter at all.
Could anybody tell what should I do?
put the following code in ReportStart event
Parameter myParam1 = new Parameter();
myParam1.Key = user_id;
myParam1.Type = Parameter.DataType.String;
myParam1.PromptUser = false;
this.Parameters.Add(myPara
But datasource does not receive parameter at all.
Could anybody tell what should I do?
are you setting the value? also how do you use this parameter? in a select query?
ASKER
Yes, value set, I checked that and select query look like this:
SELECT * from memo m
where m.memo_userid = <% myParam1|enter user id|'ALL'%>
SELECT * from memo m
where m.memo_userid = <% myParam1|enter user id|'ALL'%>
but where do you set the value of this parameter?
i see you create a parameter, set its properties (but not the value, so value should be null by default) and query uses ALL because you never provided a value for your parameter
i see you create a parameter, set its properties (but not the value, so value should be null by default) and query uses ALL because you never provided a value for your parameter
here is a sample i found on net
you are missing
myParam1.DefaultValue = "This is myParam1 default value"
http://www.datadynamics.com/Help/ActiveReports6/arHOWAddParameters.html
you are missing
myParam1.DefaultValue = "This is myParam1 default value"
http://www.datadynamics.com/Help/ActiveReports6/arHOWAddParameters.html
Dim myParam1 As New Parameter()
myParam1.Key = "myParam1"
myParam1.Type = Parameter.DataType.String
myParam1.PromptUser = True 'set to False if you do not want input from user
myParam1.Prompt = "Enter last name:"
myParam1.DefaultValue = "This is myParam1 default value"
Me.Parameters.Add(myParam1)
ASKER
I did not type it here, I checked with a messagebox, value is not null
Parameter myParam1 = new Parameter();
myParam1.Key = user_id;
myParam1.Value = s_user;
myParam1.Type = Parameter.DataType.String;
myParam1.PromptUser = false;
this.Parameters.Add(myPara m1);
I saw that sample it is for VB lower there for C#
Parameter myParam1 = new Parameter();
myParam1.Key = user_id;
myParam1.Value = s_user;
myParam1.Type = Parameter.DataType.String;
myParam1.PromptUser = false;
this.Parameters.Add(myPara
I saw that sample it is for VB lower there for C#
so you added this code to
Double-click in the gray area below the report to create an event-handling method for the ReportStart event.
Add code to the handler to change the data source at run time.
if you add this into ReportStart, then it should be fine...
Double-click in the gray area below the report to create an event-handling method for the ReportStart event.
Add code to the handler to change the data source at run time.
if you add this into ReportStart, then it should be fine...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.