Fix: Type mismatch errors w/ MySQL 4.1 and above - Posted (16059 Views)
Starting Member
JiveMiguel
Posts: 4
4
I think I’ve discovered the solution to this problem. The quick answer:
Go to config.asp and edit the MySQL connection string. Change OPTION=4 to OPTION=16387.
For a detailed explanation, which should be of interest to the developers and moderators, read on. Sorry this is so long, but I wanted to be sure to explain myself thoroughly. Keep in mind that this worked for me, your mileage may vary.
I just installed Snitz Forums version 3.4.05. I’m using it with MySQL 4.1, and MyODBC 3.51, all on a Windows 2000 server, running IIS5. I followed the setup instructions and everything went fine. When I went to view the forum page for the first time, I got the following error in the statistics section:

Type mismatch
/snitz/default.asp, line 923

I looked at the code, and noticed that the error was occurring during a comparison of integer values. I added the ‘cint’ function, and it fixed the problem. But, I then encountered the error again, and again and again at other points in the code on other pages. I looked deeper and found that the variable that was causing the error in the first instance (default.asp, line 923), ‘Member_Count’, was derived from a SELECT COUNT statement. A little more research revealed this:

http://dev.mysql.com/doc/mysql/en/count-error.html

The COUNT aggregate function in MySQL returns a BIGINT value. ADO doesn’t like BIGINTs, which I knew, so it converts the data to a string, which ultimately resulted in the ‘Type Mismatch’ error. Once I realized this, I examined the connection string used in config.asp. Sure enough, the OPTION= value wasn’t set correctly (based on my past experience). It came shipped set at ‘4’. I changed it to 16387 and all the ‘type mismatch’ errors went away! The values for the OPTION command can be found here:

http://www.dwam.net/mysql/asp_myodbc.asp

You’ll notice that option 16384 says “Change LONGLONG columns to INT columns, as some applications can't handle LONGLONG or BIGINT.” Add option 16384 with options 1 and 2 from the same list, (1+2+16384 = 16387) and you’ve specified to MyODBC the exceptions that it needs to consider when ADO is the client. If you read the page above carefully, the author states that as of MyODBC 3.51 you can use OPTION=3. I’ve found this to NOT be true, and that OPTION=16387 is still necessary, and works in EVERY case. It may be true that MyODBC now supports BIGINT, but ADO still does not.
I think this may solve a lot of problems people were having with Snitz Forums when using it with MySQL.
Thanks for reading, and good luck to all! <
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Development Team Member
Davio
Posts: 12217
12217
Thanks for that info Jive.<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
Indeed, thx Jive, that's a very useful info.<
Posted
Support Moderator
Podge
Posts: 3776
3776
I remember looking for ages to find information on the option=4 parameter of the connection string.

Thanks for the explanation too.<
Posted
Starting Member
bescher
Posts: 4
4
Thank You it looks like this fixed my problems

Bob Escher<
Posted
Junior Member
spyordie007
Posts: 408
408
thanks for the info, works for me<
Power - The only narcotic controlled by the SEC, not the FDA.
Prosperity without pollution! The American Hydrogen Association - http://www.ahanw.org
Questions about Hydrogen? Post them on our forum - http://www.ahanw.org/forum
Posted
Junior Member
Hopeful
Posts: 130
130
My server (brinkster) just updated their mysql to version 4.1.8 from 4.0. My forum worked perfect before but now has numerous type mismatch errors... and it will say no topic found... I changed the option as stated above but it did not fix my problem. Does anyone know how to solve this?

NEVERMIND!!! Tech support had tried to change a few pieces of code to fix the mismatch error prior to me reading this so the option # change did not work, but once he changed everything back the option # change fixed everything!!! Thanks a million..... Should have checked here first before calling the server smile! But hay... Now there is at least one tech support over there that is aware of the change needed to work with their new version of mysqlcool!
<
Please explain everything in layman terms!!!
Posted
Development Team Member
Davio
Posts: 12217
12217
I don't want users start posting thier type mis-match problems in this topic, so I'm locking it. If you have problems, create a new topic about it.<
Posted
Development Team Member
Davio
Posts: 12217
12217
FYI: the OPTION=16387 is now the default for Snitz Forums 3.4.06.<