Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2003
    Location
    Apopka, FL
    Posts
    6

    Unanswered: VB6, ADO and OS/400 V5R2

    My company recently upgraded to OS/400 V5R2 from V5R1. We have an application created in-house using VB6 that worked well before the upgrade, but has been giving problems ever since. The program uses ADO to read several database tables from the AS400. When some tables are opened we have access to all the fields, while with others only the last field is accessible.

    MSI is the database being accessed and it is set up thus:

    Set MSI = New Connection
    MSI.CursorLocation = adUseClient
    MSI.ConnectionString = "PROVIDER=MSDASQL;DSN=MSI;uid=;pwd=;"

    To access table DLM:

    DLM_SQL = "Select DMUNIT, DMLOT, DMSUB from DLM"
    set ADODLM = New Recordset
    ADODLM.Open DLM_SQL, MSI, adOpenDynamic, adLockPessimistic

    This is successful and gives me the required records and fields.

    When I try to access table DLM2:

    DLM2_SQL = "Select DMDEAL, DMCNST, DMWNDR from DLM2"
    set ADODLM2 = New Recordset
    ADODLM2.Open DLM2_SQL, MSI, adOpenDynamic, adLockPessimistic

    When I check the fields in the result set, I get DMWNDR as ADODLM2.Fields(0).Name, and the other Field names come up blank. DMDEAL and DMCNST do not show up at all. ADODLM2.Fields.Count does give me 3, however.

    This all worked before the upgrade. We are trying to find out from IBM if they have ever seen this before, but in the meantime, I am also trying to see if this anyone here has come across a similar problem.

    Any help would be appreciated. Thanks!

  2. #2
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    Though I do not have experience with this platform in particular, I do have a lot of VB6/ADO/ODBC experience.

    My first guess would be an ODBC driver issue. See if there are any updates.

    You could also try upgrading the version of MDAC (Microsoft Data Access Components) you have installed. I believe MDAC 2.8 is the most recent. You can download it from http://msdn.microsoft.com/library/de...entid=28001860

    You could also try using explicit field naming. Try this:
    DLM2_SQL = "Select DMDEAL AS DMDEAL, DMCNST AS DMCNST, DMWNDR AS DMWNDR FROM DLM"

    Let us know what you find out...
    -bpd

  3. #3
    Join Date
    Aug 2003
    Location
    Apopka, FL
    Posts
    6
    Originally posted by bpdWork

    >You could also try using explicit field naming. Try this:
    >DLM2_SQL = "Select DMDEAL AS DMDEAL, DMCNST AS DMCNST, >DMWNDR AS DMWNDR FROM DLM"


    Thanks for your reply. I have upgraded to MDAC 2.8 with no change in the behavior. I will try using explicit field naming and let you know how it goes.

    I am also thinking of changing the provider from MDASQL to IBM AS400 OLE DB Provider. I would just need to get Client Access Express set up.

  4. #4
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    If they make an OLEDB client, that sounds like the best solution. It'll probably be fast than ODBC too.
    -bpd

  5. #5
    Join Date
    Aug 2003
    Location
    Belgrade
    Posts
    68

    Question Re: VB6, ADO and OS/400 V5R2

    Originally posted by everpat
    When I check the fields in the result set, I get DMWNDR as ADODLM2.Fields(0).Name, and the other Field names come up blank. DMDEAL and DMCNST do not show up at all. ADODLM2.Fields.Count does give me 3, however.
    What do you get when you try:

    Debug.Print ">" & ADODLM2.Fields(1).Name & "<"
    Debug.Print ">" & ADODLM2.Fields(2).Name & "<"

    (I put the < and > characters just in case output is made of nonprintable caracters)

    If you get blank or noprintable names, looks like something is wrong with your ODBC driver. Can you upgrade to a newer version or (better) to an OLEDB driver?

  6. #6
    Join Date
    Aug 2003
    Location
    Apopka, FL
    Posts
    6
    I was able to get the program to work by switching from the MSDASQL Provider to IBM's AS400 OLE DB Provider. There is an issue regarding variable length fields, but at least I am now able to run the program.

    Thanks to all who replied.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •