Link to home
Start Free TrialLog in
Avatar of MVLIS
MVLISFlag for United States of America

asked on

error on sql selection from as400 using visual basic

Dim selectCMD As Odbc.OdbcCommand = New Odbc.OdbcCommand("SELECT M$EMIT FROM KSEDTALIB.M$MEMP WHERE M$EMID = " & Engine & "", MyODBCConnection)

        'Initialize the reader
        Dim dr As Odbc.OdbcDataReader = selectCMD.ExecuteReader

when I change WHERE M$EMID = 'FXT00VA00097' it works and selects the right statement

but when I define Engine = "FXT00VA00097" and put WHERE M$EMID = " & Engine & "",

it gives the error
ERROR [42S22][IBM][iSeries Access ODBC Driver][DB2 UDB]SQL 0206 - Column FXT00VA00097
not in specified tables

I have to use a variable for the data selection. any help would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MVLIS

ASKER

thank you very much.