ADO OleDB Visual Foxpro
具体问题: VARCHARMAPPING=True 是否适用于 Visual FoxPro 的 Ado OleDB 连接?如果是这样,连接字符串应该是什么样子?
我们正在开发一个 Delphi 应用程序,该应用程序使用旧的 Visual FoxPro 数据库的一部分作为基础。今天早上,我与数据库建立了一个有效的连接,无论出于何种意图和目的,它都做了正确的事情,但现在不再了。
有效的是 varcharmapping,即没有填充。
Delphi 2010,使用ADOConnection、AdoQuery。使用微软 Visual FoxPro 9.0 Sp2。如果有新的请告诉我。
连接字符串看起来像这样:
'Provider=VFPOLEDB.1;Data Source=C:\PROGRAMDATA\Folder\DataFolder;Collating Sequence=SWEFIN;DSN="";VARCHARMAPPING=True;'
我已经尝试了所有属性的每一种排列(感觉很好),但无济于事。任何建议都非常感激。
Specific question:
Does VARCHARMAPPING=True work on Ado OleDB connections for Visual FoxPro? and if so how should the connectionstring look like?
We're developing a Delphi application that uses parts of an old visual foxpro database as a base. This morning I had a working connection to the database that for all intents and purposes did the correct thing, but now, no longer.
The thing that did work was the varcharmapping, I.e. no padding.
Delphi 2010, using ADOConnection, AdoQuery. Using Microsoft Visual FoxPro 9.0 Sp2 . If there are any newer please tell me.
The connectionstring looks like this:
'Provider=VFPOLEDB.1;Data Source=C:\PROGRAMDATA\Folder\DataFolder;Collating Sequence=SWEFIN;DSN="";VARCHARMAPPING=True;'
I've tried every permutation (well feels like it) that there is of all attributes, but to no avail. Any suggestions much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SET VARCHARMAPPING 命令用于确定如何Visual Foxpro 在 Foxpro 应用程序中生成游标(与 ADO 记录集类似但非常不同)。此命令严格影响 Foxpro 光标,并且不通过支持Visual FoxPro Ole DB 提供程序。
我相信最好的选择是修改您的 FoxPro 数据库以使用 列的 varchar 数据类型。此问题的原因与 char 和SQL Server 中的 varchar 数据类型。
char 是固定宽度的列。如果记录中的数据未完全填满该列,则会添加填充。对于 varchar 来说情况并非如此,它是一个可变长度字段,并且仅分配所需的空间(即没有填充)。
更新 即使使用 varchar 数据类型,也要填充 仍然可能发生。因此,出于兼容性原因,您应该始终修剪值。
The SET VARCHARMAPPING command is used to determine how Visual Foxpro generates cursors (similar to but very different from ADO recordsets) within a Foxpro application. This command strictly affects Foxpro cursors and isn't supported through the Visual FoxPro Ole DB provider.
I believe the best alternative is to modify your FoxPro databases to use varchar data type for columns. The reasoning for this issue is the same difference between the char and varchar data types in SQL Server.
A char is a fixed width column. If the data in a record does not completely fill the column, padding is added. This is not true for varchar, which is a variable length field, and only allocates as much space as required (i.e. no padding).
Update Even when using the varchar data type, padding can still occur. So, for compatibility reasons, you should always trim values.