Last post Apr 09, 2010 09:14 AM by hiral.hapani
Apr 08, 2010 07:15 AM|dON5324|LINK
Got a two part question, hope somebody can help.
I'm trying my hands to, no avail, to do this
1. Provide a list of the columns of a table in the DB to the User. Each column would have a checkbox next to it.
2. User can check/uncheck columns. When the user hits a button (e.g. Export) the data under the checked columns in the DB Table will be exported (Excel or CSV).
Now I have this bit of SQL (SELECT * FROM VW_RBMP_WATER_BODY_DOWNLOAD WHERE 1=2) that list the columns (in Oracle SQL developer) but I can't seem to get my head round doing all the other fancy stuff. Also, I've a got the codes that can export to Excel and
Can anyone help with a bit of code?
Visual Studio 2008
ASP.NET with Oracle in IIS v5
Apr 08, 2010 09:30 AM|hiral.hapani|LINK
please generate string with the checked column and pass them in sp as parameter and in sp use as below:
Select @parameter frim table name.
let me know if you have any other query.
Apr 09, 2010 03:58 AM|dON5324|LINK
Any chance you could stitch something together? To be honest I'm new at this and have been struggling for days.
Apr 09, 2010 09:14 AM|hiral.hapani|LINK
Sure please have a look below:
You have table: User
Field Name: Firstname, lastname , Address, Phone
In your page you are displaying this names with checkbox. Please make sure that field name must have to be same with database's table's column name.
So now in page user is selecting only firstname and phone.
Now please sample procedure.
declare @parameter varchar(1000)
set @parameter = 'Firstname, Phone'
declare @str varchar(max)
set @str ='Select '+@parameter +' from User'
Let me know if you have any query for the same.