热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

MySQLODBC5.1驱动程序向ADODB返回错误的数据类型-MySQLODBC5.1driverreturnswrongdatatypetoADODB

Situation:workingwithlegacyclassicASPcode,attemptingtomovethecodebasefromanoldserver

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

情况:使用传统的经典ASP代码,尝试将代码库从旧服务器移动到新服务器。

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驱动程序和ADODB.Connection对象连接到Windows服务器上的MySQL数据库。

Connection String = "Driver={MySQL ODBC 5.1 Driver};Server=dbserver;Database=dbname;Uid=username;Password=password;Option=3"

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

查询结果在ADODB.RecordSet对象中返回。当我尝试访问包含标准MySQL Integer的字段时,我收到此错误:

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

Microsoft Vbscript运行时错误“800a01ca”变量使用Vbscript中不支持的自动化类型

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.

如果我使用cLng()手动转换字段,则会消除错误并返回正确的值。但是,有太多代码可以手动查找每个对整数的引用并手动转换它。

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)

VarType()为这些值返回19,这似乎是VB无法理解的某种类型的Long数据类型。 (请参阅此处)ODBC驱动程序是否应该为长整数返回VarType 3? (看这里)

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

我尝试在连接字符串的“option =”参数中传递选项16384(NO_BIGINT),但它没有任何区别。

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.

知道怎么纠正这个吗?似乎应该有一个选项传递给MySQL ODBC驱动程序返回long作为Long Integer数据类型,但我找不到它。

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.

在任何人提到它之前:是的,我们知道经典的ASP是坏的。不,我们现在没有资源将此代码移植到其他地方。我们只需要它继续在当前时间使用经典ASP。

1 个解决方案

#1


1  

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.

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

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.

具有UNSIGNED属性的整数字段会导致错误。删除此属性会导致字段值作为标准Integer类型返回。显然,ODBC驱动程序没有正确处理从unsigned int到Vbscript Integer类型的转换,而是返回指向Long的指针。

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.

我也注意到tinyint(1)字段上的这个问题,我用它作为布尔值。将数据类型从tinyint(1)更改为int(11)[默认]也消除了此错误。

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 Driver论坛中发布了此问题,但没有人愿意回应。


推荐阅读
  • .NET中各种数据库连接大全(转)[more].NET中各种数据库连接大全sql.gif)SQLSERVEROdbCStandardSecurity:driver{SQLSe ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • 利用Visual Basic开发SAP接口程序初探的方法与原理
    本文介绍了利用Visual Basic开发SAP接口程序的方法与原理,以及SAP R/3系统的特点和二次开发平台ABAP的使用。通过程序接口自动读取SAP R/3的数据表或视图,在外部进行处理和利用水晶报表等工具生成符合中国人习惯的报表样式。具体介绍了RFC调用的原理和模型,并强调本文主要不讨论SAP R/3函数的开发,而是针对使用SAP的公司的非ABAP开发人员提供了初步的接口程序开发指导。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • iOS超签签名服务器搭建及其优劣势
    本文介绍了搭建iOS超签签名服务器的原因和优势,包括不掉签、用户可以直接安装不需要信任、体验好等。同时也提到了超签的劣势,即一个证书只能安装100个,成本较高。文章还详细介绍了超签的实现原理,包括用户请求服务器安装mobileconfig文件、服务器调用苹果接口添加udid等步骤。最后,还提到了生成mobileconfig文件和导出AppleWorldwideDeveloperRelationsCertificationAuthority证书的方法。 ... [详细]
  • asp中如何嵌入python的简单介绍
    本文目录一览:1、如何在IIS中执行Python脚本 ... [详细]
  • asp.net(vb脚本)如何获取xml的节点值?xmlversion1.0encodingutf-8?rootimageimagemenusmenuurl#frame_paren ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • Python瓦片图下载、合并、绘图、标记的代码示例
    本文提供了Python瓦片图下载、合并、绘图、标记的代码示例,包括下载代码、多线程下载、图像处理等功能。通过参考geoserver,使用PIL、cv2、numpy、gdal、osr等库实现了瓦片图的下载、合并、绘图和标记功能。代码示例详细介绍了各个功能的实现方法,供读者参考使用。 ... [详细]
  • 本文讨论了如何使用Web.Config进行自定义配置节的配置转换。作者提到,他将msbuild设置为详细模式,但转换却忽略了带有替换转换的自定义部分的存在。 ... [详细]
  • http:www.cnblogs.compirloarchive200909091563368.html以前操作Excel的话,一般都会去用Microsoft.Jet.OLEDB.4. ... [详细]
author-avatar
wugege
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有