• Subject: Re: VB & ADO don't seem to handle numeric fields
  • From: "Peter Dow" <pcdow@xxxxxxxxxxxxxxx>
  • Date: Mon, 27 Nov 2000 10:33:28 -0800

Hi John,

Thanks for the offer of taking it offline, but as I was composing the email
to send to you offline, I found the solution. Read on.

As I noted in the last email you replied to, I used this code

    Dim fld As ADODB.Field
    For Each fld In AS400rs.Fields
        Debug.Print fld.Name
        Debug.Print fld.ActualSize
        Debug.Print fld.DefinedSize
        Debug.Print fld.Type
    Next

to produce these results:

RTCODE
   2
   10
   200
RTDESC
  13
  50
  200
RTAMT
  16
 -1
  14

The suspicious thing is the defined size for RTAMT, -1. It's actually 11.2
packed. Which makes the actual size odd also, unless it's talking about the
actual size on the PC side. There it's simply defined as type Currency,
which does occupy 16 bytes as I recall. The type of 14 is adDecimal (I did
?adDecimal in the debug window to verify that).

I added debug.print fld.value and it gets the usual "Invalid procedure call
or argument" error when it gets to RTAMT.

The source of data is a table (i.e. physical file):

  AS400con.ConnectionString = "Provider=IBMDA400; Data
Source=NETSHARE_TS400D;"
  AS400con.CommandTimeout = 15
  AS400con.CursorLocation = adUseClient
  AS400con.Open

  AS400cmd.ActiveConnection = AS400con
  AS400cmd.CommandType = adCmdText
  AS400cmd.CommandText = "SELECT * FROM PDOWD.RATEP"
  AS400cmd.Prepared = True

At this point I tried specifying the fields in the SELECT stmt, i.e.

  AS400cmd.CommandText = "SELECT RTCODE,RTDESC,RTAMT FROM PDOWD.RATEP"

and it worked! So it looks like IBM's ADO provider doesn't handle * very
well. But at least I have a solution.

Thanks for all your efforts!

Peter Dow
Dow Software Services, Inc.
909 425-0194 voice
909 425-0196 fax


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].