Re: Error reading recordset from DB2/AS400



Thanks for your replies Ralph and Bob.

2) Dump the '*' for now and specifically request and return columns so you
can see what is happening. The error you are reporting is always related to
a confused query, taking it in smaller bits may help to isolate the exact
point of failure.

Everything is fine up until the first date field.

1. The cursor doesn't seem to know the record count (eg.
adoRecSet.RecordCount = -1).

Why is this a big deal? There are other ways to determine record count.

Its not a big deal. But it was working before and I had coded for it
(setting grid sizes).

2. I still get the same error message on the first adDBDate field when
the value is not NULL.

I would modify the sql statement in the procedure to use COALESCE to
make sure Nulls were not returned, substituting an impossible date
(99991231 for example) for the Nulls (this will require that you specify
the fields to be returned, but doiing so is really good programming
practice anyways. "Select *" should be avoided in production code):
SELECT COALESCE(datefield,99991231) as datefield, ...

Normally there will be no null value, and it works okay for null
anyway. This is just what was in the field for my brief test. Putting
a valid date in the field causes the error described previously. Also,
I noticed that when I use the ODBC driver the field type is adDBDate,
but it is not being read correctly (eg. error). Using the IBMDA400
driver, the field type shows as adChar. This allows me to read the
field value, but it is garbage, as are all the subsequent field
values. Its as if the data length the ADO recordset is expecting for
these date fields is not correct.

.



Relevant Pages

  • Re: Setting Null value in SQL update statement
    ... Robert Dufour wrote: ... There's a field FK, which is defined to allow nulls in the table definition, ... the field type is integer. ... you would never expect, eg. -9999, then if FK has this value exclude it ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Setting Null value in SQL update statement
    ... which is defined to allow nulls in the table ... the field type is integer. ... You don't mention which mechanism you are using to update/insert your ... you would never expect, eg. -9999, then if FK has this value exclude it ...
    (microsoft.public.dotnet.languages.vb)
  • Setting Null value in SQL update statement
    ... I have a sub to update a record in a sql server 2000 table. ... There's a field FK, which is defined to allow nulls in the table definition, ... the field type is integer. ...
    (microsoft.public.dotnet.languages.vb)