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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smanif1
    New Member
    • May 2010
    • 4

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

    Code:
    Report_Name_Final = "TABLENAME"
    DIM mySQL1
     mySQL1 = "SELECT * FROM [TABLENAME]"
     mySQL1 = replace(mySQL1,"[TABLENAME]",Request.Form("Report_Name_Final"))
    
    response.write objRS1("Value")
    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'.
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    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

    Comment

    Working...