Search code examples
vb.netrecordibm-midrangedisplay

Display Table Records from AS400 to Visual Basic


I'm trying to display the records from PYLEAVE table, but when I use this code, it shows error SQL0204, can someone help me?

Call takeconnectionas400()
    conn.Close()
    conn.Open()
    adapter = New OleDbDataAdapter("select * from PRIMA.PYLEAVE", conn)
    ds = New DataSet
    adapter.Fill(ds, "PRIMA.PYLEAVE")
    DGVAS400.DataSource = ds.Tables("PRIMA.PYLEAVE")
    DGVAS400.ReadOnly = True

Solution

  • In DB2 for IBM i, the syntax for the table is not DBNAME.TABLENAME it is SCHEMA.TABLENAME In old AS/400 terminology, that is LIBRARY.FILE Have your IBM i administrator tell you what schema (library) the table is in and change your SELECT statement appropriately.

    I don't know VB, but in JDBC you specify the database name in the connection string, not the SELECT statement.