作者:wugege | 来源:互联网 | 2023-09-25 11:56
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 个解决方案