Raif,
When is that you decide the table name? If you have the table name decided before you construct this select statement, you can probably use this way, which is done in the frontend, well before it hits the DB for executing the query.
suppose strTblName contains the table name that you wanted to query.
Dim strSQL As String = "SELECT email From " & strTblName & " Where fullname = @pUser"
You cannot pass table name as parameter with the kind of approach you have here. Not sure if you are using SQL server/any other DB. If SQL server, then you can create stored proc that constructs the sql string and use exec() function to run that.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|