Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb asp type mismatch error with getrows

Status
Not open for further replies.

keak

Programmer
Joined
Sep 12, 2005
Messages
247
Location
CA
Hi there,

I am manipulating some db rows I get back. I find the problem hard to track down since this same code is working perfectly on another machine (using postgres7.4). I am using postgres8.1 and for some reason its giving me this error.

I was wondering if I can get pointers as to which part of the code may be wrong.

Code:
allForumData = rsForum.GetRows(adGetRowsRest)
for iForumCheck = 0 to recForumCount
   if CatID = allForumData(fCAT_ID, iForumCheck) then bContainsForum = True   <- this is the line where I get the type mismatch
next

and I am getting
Microsoft VBScript runtime error '800a000d'

Type mismatch

 
make sure the data types of the following:

CatID,
fCAT_ID

are same...

-DNG
 
allForumData([highlight]fCAT_ID[/highlight], iForumCheck)

where do you declare the variable fCAT_ID ?

if it is the name of your table column, then this wont work, this is a two dimensional array expecting two numbers; the first is the column index and the second the row index.

That's probably why you are getting a type mismatch error.

A smile is worth a thousand kind words. So smile, it's easy! :-)
 
more to the point is where does this recForumCount get defined? and you will probably find it is -1 if you write it to the browser.

You would be better using ubound(allForumData,2) to get the record count

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
humm.
Thanks for the pointers. I also tried
Code:
   if CatID = allForumData(1, 2) then bContainsForum = True

just to check whether it was the interger mismatch error, but then I still get the same error.
allForumData (the res record) should take two interger numbers right ?

I also tried casting those two variables into int first but i still got the same error.
 
well if an array is being returned it will.
have you checked that it is an array and records are being returned?

The first parameter has the number of columns (fields) the second the number of rows (records)

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
I think I finally figured out what was wrong.
The code i had was doing implicit casting from strings -> int.

When I do variable = cInt (variable), it worked correctly.
Is there a way to enable this default casting functionality in asp or iis ?

If not, i will have to cast all variables ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top