469,934 Members | 2,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

dynamic table name:- [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrec

Expand|Select|Wrap|Line Numbers
  1. Report_Name_Final = "TABLENAME"
  2. DIM mySQL1
  3.  mySQL1 = "SELECT * FROM [TABLENAME]"
  4.  mySQL1 = replace(mySQL1,"[TABLENAME]",Request.Form("Report_Name_Final"))
  5.  
  6. response.write objRS1("Value")
  7.  
trying to get dynamic table name
i getting this error

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'FROM'.
May 26 '10 #1

✓ answered by jhardman

shouldn't you have to specify the query before you open the recordset? Or did you just leave off that part? When I get a syntax error that isn't obvious, I like to print out (response.write) the final query just to see how it looks, sometimes that's enough to see where the error is. Otherwise, you can take your final query and drop it in a query analyzer.

Jared

1 2591
jhardman
3,406 Expert 2GB
shouldn't you have to specify the query before you open the recordset? Or did you just leave off that part? When I get a syntax error that isn't obvious, I like to print out (response.write) the final query just to see how it looks, sometimes that's enough to see where the error is. Otherwise, you can take your final query and drop it in a query analyzer.

Jared
May 28 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Martin Feuersteiner | last post: by
3 posts views Thread by Martin Mrazek | last post: by
1 post views Thread by russ | last post: by
3 posts views Thread by ryanmhuc | last post: by
5 posts views Thread by devx777 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.