[英]How to Connect to Sage 50 ODBC Database with PHP
I'm attempting to export data from Sage 50 database.我正在尝试从 Sage 50 数据库中导出数据。 I have managed to create a connection to the database however whenever I perform a query I have the following error message.我设法创建了到数据库的连接,但是每当我执行查询时,我都会收到以下错误消息。
Warning: odbc_exec(): SQLColAttribute can't handle
SQL_DESC_OCTET_LENGTH
: [S1C00] Driver not capable in C:... on line 4警告:odbc_exec():SQLColAttribute 无法处理SQL_DESC_OCTET_LENGTH
:[S1C00] 驱动程序不支持 C:... 第 4 行
I have Attempted to change the cursor to SQL_CUR_USE_CODE
as suggested on PHP.net我已尝试按照PHP.net 上的建议将光标更改为SQL_CUR_USE_CODE
I am also sure it is connecting as when I enter a table name that doesn't exist then I am receiving this error.我也确定它正在连接,因为当我输入一个不存在的表名时,我收到了这个错误。
Warning: odbc_exec(): SQL error: Table not found, SQL state S0002 in SQLExecDirect in C:... on line 4警告:odbc_exec():SQL 错误:找不到表,SQL 状态 S0002 在 C:... 中的 SQLExecDirect 中的第 4 行
$conn = odbc_connect("TestDB", "Manager", "", SQL_CUR_USE_ODBC);
$sql="SELECT * FROM STOCK";
$result=odbc_exec($conn,$sql);
Thanks in advance提前致谢
I was having a similar issue with ac# application, but my solution may have some pertinence here and I hate to see someone go through the stress that I did.我在 ac# 应用程序中遇到了类似的问题,但我的解决方案在这里可能有一些相关性,我讨厌看到有人经历我所做的压力。 Here's what I did to fix my issue:这是我为解决问题所做的工作:
Hope that helps!希望有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.