LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

query SQL error

Hi,
 
I have successfully conect to my database as the following codes:
 
   hdbc = DBConnect("DSN=Microsoft Access Driver");    // this link to my.mdb database file
    
      if (hdbc <= 0)
      {
             MessagePopup("Database Error",DBErrorMessage());  
      }
But when execute the next command:
           
   hstmt = DBActivateSQL (hdbc, "SELECT Double FROM Number");   // Table: Number, Column: Double
 
Then an error occured:
 
   DBActivateSQL function return value = -10
   [ODBC Microsoft Access Driver] Syntax error in FROM clause
 
Can anyone know why?
0 Kudos
Message 1 of 3
(3,147 Views)
Most likely the reason you are encountering problems is because both Number and Double are reserved words in Access.  I'm surprised it didn't warn you.  Databases have reserved words that should not be used for any column or table names because they might be used elsewhere in the system.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 3
(3,128 Views)

Thanks for remnding, you are right! I did try to change to Val_Double & Val_Integer... it still showed same error. With your advice I have changed completelely to ValDB, ValInt & , table name (Table) changed to Account it has now worked!

I wonder the table name (Table or Value) is reserved too?

Thanks

0 Kudos
Message 3 of 3
(3,105 Views)