Hello Everybody!
I have the following problem: I want to make an application, which need tables to show, edit, etc. You would be able to select the table, which you want to work on, by a dropdownlist (the whole project is in ASP.NET). I want to load the selected table's data to a gridview, and I desperately need a selectcommand for it.
I have succesfully retreived the name of the table, which is selected in the dropdownlist, with a sqlparameter, but can't use it in my selectcommand. The code is the following:
select * from (Select table_name
from information_schema.tables
where table_name= @table_name)
I know it probably looks lame, but the simple
select * from @table_name
refused to work too.
To the first one, I get the error message "incorrect syntax near ')'
For the second, it tells me that I must declare the table variable, but I have no idea, how to link it with the dropdownlist.
I thank you forwardly to your help!