I have a database(Postgr eSQL) table(about 70k rows).I am developing an ASP
webpage and there is a list-box on it which contains the name of the
columns of that table. User selects the column name from that box and a
query is sent to the database. The data from that column should be
returned to the user.
Now the problem is that, I have seen the 'SELECT' statements with the
exact column name written in it.But in my case the column name is
variable.So, I am not able to understand how should I write such
query,where column name is like a parameter passed by the user.I am
working in .net for developing the webpage.
I tried to use a prepare statement....
PREPARE statement(text) AS SELECT $1 FROM table_name;
EXECUTE statement(colum n_name);
this returns....
?column?
---------------
column_name
column_name
column_name
column_name
column_name
..........
..........
column_name
I can't figure out the problem in this .........if there is another solution to this plz suggest.......
thanx
webpage and there is a list-box on it which contains the name of the
columns of that table. User selects the column name from that box and a
query is sent to the database. The data from that column should be
returned to the user.
Now the problem is that, I have seen the 'SELECT' statements with the
exact column name written in it.But in my case the column name is
variable.So, I am not able to understand how should I write such
query,where column name is like a parameter passed by the user.I am
working in .net for developing the webpage.
I tried to use a prepare statement....
PREPARE statement(text) AS SELECT $1 FROM table_name;
EXECUTE statement(colum n_name);
this returns....
?column?
---------------
column_name
column_name
column_name
column_name
column_name
..........
..........
column_name
I can't figure out the problem in this .........if there is another solution to this plz suggest.......
thanx
Comment