MySQL ODBC 5.1 驱动程序向 ADODB 返回错误的数据类型

MySQL ODBC 5.1 driver returns wrong datatype to ADODB(MySQL ODBC 5.1 驱动程序向 ADODB 返回错误的数据类型)
本文介绍了MySQL ODBC 5.1 驱动程序向 ADODB 返回错误的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况:与传统经典的ASP代码的工作,试图将代码库从旧服务器移动到一个新的.

Situation: working with legacy classic ASP code, attempting to move the codebase from an old server to a new one.

代码尝试连接到使用MySQL ODBC 5.1驱动器和所述ADODB.Connection对象在Windows服务器上MySQL数据库.

The code attempts to connect to a MySQL database on a Windows server using the MySQL ODBC 5.1 driver and the ADODB.Connection object.

<代码>连接字符串= 驱动器= {MySQL的ODBC 5.1驱动};服务器= DBSERVER;数据库= dbname;开发UID =用户名;密码=密码;选项= 3"

查询结果列于ADODB.RecordSet对象返回.当我试图访问包含标准的MySQL整型字段,我得到这个错误:

Query results are returned in ADODB.RecordSet objects. When I try to access a field containing a standard MySQL Integer, I get this error:

Microsoft VBScript运行错误 '800a01ca',点击变量使用自动化类型不在VBScript支持的

Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript

如果我使用CLNG手动转换字段()然后被消除错误,并返回正确的值.然而,有太多的代码,以手动查找每个引用的整数和手动转换它.

If I manually convert the field using cLng() then the error is eliminated and the correct value is returned. However, there is too much code to manually look for each reference to an integer and manually convert it.

VarType函数()返回19为这些值,这似乎是某种类型的数据类型龙那VB不理解.( 看这里)是不是应该返回VarType函数3长整数ODBC驱动程序?(见这里)

VarType() returns 19 for these values, which appears to be some type of Long datatype that VB doesn't understand. (See here) Isn't the ODBC driver supposed to return VarType 3 for long integers? (see here)

我试图传递选项16384(NO_BIGINT)中的选项="连接字符串的参数,但它没有任何区别.

I tried passing the option 16384 (NO_BIGINT) in the "option=" parameter of the connection string but it didn't make any difference.

不知道如何纠正呢?这似乎应该传递给MySQL的ODBC驱动程序返回多头为长整型数据类型的一种选择,但我不能找到它.

Any idea how to correct this? It seems there should be an option to pass to the MySQL ODBC driver to return longs as Long Integer datatype, but I can't find it.

在任何人提到它:是的,我们知道传统的ASP是坏的.不,我们没有足够的资源,以港口这个代码到别的东西现在.我们只是需要继续在传统的ASP工作当前时间.

Before anyone mentions it: yes we know classic ASP is bad. No we don't have the resources to port this code to something else right now. We just need it to continue working on classic ASP for the current time.

推荐答案

通过消去我终于发现了问题的过程确定.不知道的为什么的这种情况发生,但它必须是在MySQL的ODBC驱动程序中的错误.

OK by the process of elimination I finally discovered the problem. Not sure why this occurs but it must be a bug in the MySQL ODBC driver.

整数字段具有起因误差UNSIGNED属性.除去该属性导致要返回作为标准整数类型的字段值.显然,ODBC驱动程序不处理来自无符号整型为VBScript整数类型适当地转换,并且不是返回指针到一个长

Integer fields having the UNSIGNED attribute cause the error. Removing this attribute causes the field value to be returned as a standard Integer type. Apparently the ODBC driver is not handling the conversion from unsigned int to vbscript Integer type properly, and is instead returning a pointer to a Long.

我还注意到(1),其余是用作为布尔值的字段上TINYINT这个问题.改变从TINYINT(1)至INT(11)的数据类型[默认]消除了这种错误还

I also noticed this problem on tinyint(1) fields which I was using as boolean values. Changing the datatype from tinyint(1) to int(11) [the default] eliminated this error also.

希望这会帮助别人.FYI我还张贴这个问题在MySQL的ODBC驱动程序的论坛,但没有人愿意给予答复.

Hopefully this will help someone else. FYI I also posted this issue in the MySQL ODBC Driver forum but nobody bothered to respond.

这篇关于MySQL ODBC 5.1 驱动程序向 ADODB 返回错误的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)