p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Once Again, Exception Occurred

Message #1 by "Marce Murgo" <marcella01@h...> on Fri, 1 Mar 2002 15:32:35
Marce, John Doolan caught your .EOF error while I was still writing my
advice about it.  He's fixed that error for you, and now you're into
your next one!  Again, consider the approach I've already sent to you
instead of patching up what you've done.

The GetRows method automatically creates and dimensions a
two-dimensional array of variants to contain your entire recordset.
It's pretty close to magic... one of the best things ever done in VB.

The one confusing part of using it is that the "records" in the array
are indexed with the SECOND value when accessing the array.  The
"fields" in the array are indexed with the FIRST value.  Kinda backwards
from what you'd expect.  Both are zero-based... the counting starts at
zero, not at one.  Therefore if in your SELECT query the first field you
listed is CategoryName, then in the array that's field number zero, the
second field in your list is one, etc.

In your code if you ask for the value at


you're asking for the first "field" in the first "record".  If you ask
for the value at


you're asking for the first "field" in the eighth "record" (remember,
counting starts at zero).  If the job end date is the sixth field in
your SELECT statement, then to see the value of the job end date in the
third record you'd write


Now, you should not use numbers for the array field positions in your
code... it's impossible for a human to read what your code is doing.  So
you define constants to represent those field positions, as I did in the
code I sent you.  In your original SELECT statement CategoryName was
your first field so the constant is declared


Then in your code, use that constant... it makes your code
human-readable so you or someone else knows what's being called there.

You should be able to take it from there.  Good luck.



-----Original Message-----
From: Marce Murgo [mailto:marcella01@h...] 
Sent: Friday, March 01, 2002 6:54 PM
To: Code Clinic
Subject: [proasp_codeclinic] RE: Once Again, Exception Occurred

Thanks for the input.  I do this and I get this:

Microsoft VBScript runtime error '800a000d' 
Type mismatch: '[string: "Hallo"]' 

line 42 

My character types are nvarchar.  Does this make a difference.  And what

is the 3D part of the 3Drst.fields...

If I leave the 3D part off and I get the old error message...

  Return to Index