Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Monday, March 19, 2012

Assing Report Parameters

Can you evaluate and assign a new value to a parameter in an expression for a textbox?

Did you just curse?

I'm not even sure what you're asking. It's too general. What are you trying to do?

|||

Basically you want to assign a new value to the Parameter after the user selects his option. is that correct?

If yes, you will not be able to reassign this parameter but what you can do is

1. create another hidden parameter

2. Make sure that this is placed next tothe first parameter

3. Now, you can use the expression to assign the value to this hidden parameter based on what is selected in the first parameter.

Hope this answers your question...or another option is to take it back to SQL and then use the expression in SQL to reassign the values.

assigning values to parameters dynamically

i using a bound data grid which is using a stored proc. The stored proc needs the ClientID "if logged in" there is no form or control on the page outside of the loginstatus. I am wanting to pass theMembership.GetUser.ProviderUserKey.ToString() to the asp:parameter but I cant get it to work.

So How do I pass a variable to a stored proc parameter using a bound data grid.

I this its very strange that this cant be dont and there are a raft of reason why you wold want to do this with out the need to pass it to a form control.

please help

jim

Add the parameter to you parameters collection as a normal asp:parameter, then hook up to the data-source control's Inserting/Updating evnet (I assume you use a data-source control with the grid) and use the event argument to get access to the command object's parameters collection (if you use SqlDataSource), or the InputParameters if you use the ObjectDataSource.|||Or alternatively, when the user authenticates, store their id in a session variable, then anywhere in your app you can add it as a session parameter.

Sunday, March 11, 2012

Assigning parameters in a function

I am trying to create a function in SQL 2000. Im rusty on function
syntax and need to also assign some variables for use within this
function.

Example:
create function blah (@.param1 int)

declare @.var1 int, @.var2 int

--it doesnt like this method of assigning values to my
variables????
select @.var1, @.var2 = (select name, phone from customer where id =
@.param1)

--Then I need to use those variables in this next statement...

DECLARE @.Zip int
SELECT @.Results = (select zip from table2 where name = @.var1 and phone
= @.var2)

return @.Results

-----------
Any help would be greatly appreciated at filling in the missing
syntax.> --it doesnt like this method of assigning values to my
> variables????
> select @.var1, @.var2 = (select name, phone from customer where id =
> @.param1)

Try:

select @.var1= name, @.var2 = phone
from customer where id = @.param1

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Dave" <funkdm1@.yahoo.com> wrote in message
news:f5174e0f.0404291539.211a5032@.posting.google.c om...
> I am trying to create a function in SQL 2000. Im rusty on function
> syntax and need to also assign some variables for use within this
> function.
> Example:
> create function blah (@.param1 int)
> declare @.var1 int, @.var2 int
> --it doesnt like this method of assigning values to my
> variables????
> select @.var1, @.var2 = (select name, phone from customer where id =
> @.param1)
> --Then I need to use those variables in this next statement...
> DECLARE @.Zip int
> SELECT @.Results = (select zip from table2 where name = @.var1 and phone
> = @.var2)
> return @.Results
> -----------
> Any help would be greatly appreciated at filling in the missing
> syntax.

Thursday, March 8, 2012

Assign several different sets of paramters, to be chosen by user?

Hi,

Is there a way to put in several different sets of values for the defaults in parameters, where the user could then choose which set of defaults they want?

For example, I have two drop-downs for dates: Start Date and End Date. I would also like another drop-down (or button, or whatever) called, say "Interval". It would have choices such as "1 week interval" or "52 week interval", and whatever is chosen would set the Start and End Dates to whatever default values I had assigned to the parameters in "Interval".

It's not quite the same as cascading parameters. Any suggestions would be greatly appreciated! Thanks.Sorry, but this is cascading parameters. One parameter which pulls of the data from the server and fills the other parameters afterwards, thats truly cascading.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Monday, February 13, 2012

ASP.NET ReportViewer / Non-String parameters

I am displaying a local report in a ReportViewer control on an asp.net web page. My report contains non-string parameters. How can i set a non-string parameter value on a local report?You will need to call .ToString() on your value to set it on ReportParameter.|||That would result in a string being passed to the report. I want to pass a float or a datetime to the report.

The only way i've been able to get this to work is to create a typed dataset with the "parameters" i want sent and then use aggregation functions (first,sum, etc...) to get to the data into the report. That is a big workaround in order to get a few simple floats and times into my report. Has anyone been able to get this done using another method?
|||If the data type of the parameter is set to integer/float, you can do these operations. And you can always convert between types in a report expression.