Showing posts with label dropdown. Show all posts
Showing posts with label dropdown. Show all posts

Wednesday, March 28, 2012

How to assign SQL query to Button in asp.net 2.0

Hi

My webpage contain three dropdown box and one button. One dropdown to choose hospital_id, second dropdown to choose project_id and third dropdown to choose version_no .After choosing these three and when the button is clicked i want to run this sql query

INSERT INTO version(project_id,hospital_id,date_created,comments) SELECT project_id,hospital_id,date_created,comments FROM version whereversion_no=@.version_no andproject_id=@.project_id andhospital_id=@.hospital_id.

Just i need the code in asp.net 2.0 , VB , when the button is clicked the above query should run and the parameters (values) should take from dropdown box.

Could anyone please send the solution for the above problem.

write the query like this

Dim sQuery as String = "INSERT INTO version(project_id,hospital_id,date_created,comments) SELECT project_id,hospital_id,date_created,comments FROM version whereversion_no=" + ONE_DropDown.SelectedValue + "andproject_id=" + Second_DropDown.SelectedValue + "andhospital_id=" +THIRD_DropDown.selectedValue

Try this query

Monday, March 12, 2012

How to add Optional Parameters for SQL Reporting Service 2005

Hi friends,

I am developing reports using SQL Server 2005 Reporting service

I want to pass optional parameters to Report using dropdown

I filled dataset using EmpId and EmpName. and assigned this dataset to

query the values.

I checked properties for Report Parameters of Allow Null, Allow Blank values

Even i checked this properties, it enforces me to Enter some value for dropdown while running or previewing the report

I don't want to enforce the user that value must be selected.

In short, How we can able to pass multiple parameters which are not mandatory.

Pls reply me ASAP

Any suggestion is appreciated

Thanks in Advance.

Regards

Suds

hmm.... if i set the parameter to be multivalue, there'll be error if i want to set it to Allow Null...

my solution is if user does not want to select any specific value, then they can use select all....

i don't know how to put select all as the default value... maybe someone can suggest this...

if you found out, pls share ya....

|||Add a default value of "All" and use this value with in your expressions/queries to allow for a catch all situation

eg: with in the sql where clause add the following:
and case @.empid = 'All' then table.emp_id else @.empid = table.emp_id

It is a little bit messy to write but I believe it gives you the most control over the report.

Sam Vella.|||

minority80 wrote:

i don't know how to put select all as the default value... maybe someone can suggest this...

Report -> Parameters
Select the parameter you want to add a default value to
Select the Non-Queried radio Button
Enter "All" without the quotes into the text box

Sam Vella

Friday, March 9, 2012

How to add Combo box or dropdown List for picking month,Day and Year,Seperately as a Repor

If Anyone konws that :
How to add Combo box or dorpdown list for date picking option as three
different boxes are to be used for Month, Day & Year OR Any other
way of picking date in Sql Server 2000 Reporting Services as a Report
Parameter?Look for dependent or cascading parameters concept in RS 2000. You'll want
the year to be the first parameter though so you can control leap years for
the days value (for Feb).
The other way you could implement date selection is to get a distinct list
of dates from your transactions you're querying and let the user select from
those. This however, may not be viable if you're working with a large
database.
-Tim
<ajmera.puneet@.gmail.com> wrote in message
news:1153136865.596528.34410@.b28g2000cwb.googlegroups.com...
> If Anyone konws that :
> How to add Combo box or dorpdown list for date picking option as three
> different boxes are to be used for Month, Day & Year OR Any other
> way of picking date in Sql Server 2000 Reporting Services as a Report
> Parameter?
>|||Tim Dot NoSpam wrote:
> Look for dependent or cascading parameters concept in RS 2000. You'll want
> the year to be the first parameter though so you can control leap years for
> the days value (for Feb).
> The other way you could implement date selection is to get a distinct list
> of dates from your transactions you're querying and let the user select from
> those. This however, may not be viable if you're working with a large
> database.
> -Tim
> <ajmera.puneet@.gmail.com> wrote in message
> news:1153136865.596528.34410@.b28g2000cwb.googlegroups.com...
> > If Anyone konws that :
> > How to add Combo box or dorpdown list for date picking option as three
> > different boxes are to be used for Month, Day & Year OR Any other
> > way of picking date in Sql Server 2000 Reporting Services as a Report
> > Parameter?
> >
Thanks Tim...
One more thing , How to get an input value in database (or as a
parameter Value field) for Year, Month and Day(That menas should I
enter it manually....) for picking it?|||> Thanks Tim...
> One more thing , How to get an input value in database (or as a
> parameter Value field) for Year, Month and Day(That menas should I
> enter it manually....) for picking it?
>
You could use a user defined function to return the values, you could enter
them manually in a list, you could write a stored procedure to return them,
etc. etc.
If you don't care if the user selects an invalid date, the simplest method
is to create the parameters, then enter name/value pairs for them in the
parameer dialog box. Jan = 1, Feb = 2, Mar = 3, ... Dec = 12, Then 1-31 for
day and whatever years you want to allow the user to select. This is the
fastest, but not the best solution since your users could select an invalid
date (such as Feb 31, 2005).
<ajmera.puneet@.gmail.com> wrote in message
news:1153142816.399046.24400@.75g2000cwc.googlegroups.com...
> Tim Dot NoSpam wrote:
>> Look for dependent or cascading parameters concept in RS 2000. You'll
>> want
>> the year to be the first parameter though so you can control leap years
>> for
>> the days value (for Feb).
>> The other way you could implement date selection is to get a distinct
>> list
>> of dates from your transactions you're querying and let the user select
>> from
>> those. This however, may not be viable if you're working with a large
>> database.
>> -Tim
>> <ajmera.puneet@.gmail.com> wrote in message
>> news:1153136865.596528.34410@.b28g2000cwb.googlegroups.com...
>> > If Anyone konws that :
>> > How to add Combo box or dorpdown list for date picking option as three
>> > different boxes are to be used for Month, Day & Year OR Any other
>> > way of picking date in Sql Server 2000 Reporting Services as a Report
>> > Parameter?
>> >
>
> Thanks Tim...
> One more thing , How to get an input value in database (or as a
> parameter Value field) for Year, Month and Day(That menas should I
> enter it manually....) for picking it?
>