与 FoxPro(或其他)表一起操作 oledb 表
我正在使用 VB.NET 将大量 FOXPRO/FOXWEB 文件转换为 ASP.NET。底层数据库仍将是 FOXPRO(目前)。
给定两个不同数据库中共享公共字段的两个表。 假设第一个表是“table1”,第二个表是“table2”,公共字段的名称是“cid”
假设我使用 oledb 从 table1 中提取一个名为“interestingrows”的 oledb 表,使用如下代码行:
adapter.Fill(MyDataSet, "interestingrows")
我想说的是
sql = "DELETE FROM interestingrows WHERE cid in (SELECT cid FROM TABLE2)"
......除了sql cmd被发送到我的适配器,它连接到foxpro db并且“interestingrows”是一个oledb表。
如果当我们最终决定将底层数据库切换到 MS SQL(或任何客户决定的数据库)时该解决方案能够发挥作用,那就太好了,尽管不是绝对必要的。
I'm converting a lot of FOXPRO/FOXWEB files to ASP.NET with VB.NET. The underlying database will remain FOXPRO (for now).
Given two tables in two different databases that share a common field.
Say the first table is "table1" and the second is "table2" and the name of the common field is "cid"
Say I have used oledb to extract an oledb table from table1 called "interestingrows" using a line of code something like:
adapter.Fill(MyDataSet, "interestingrows")
I would like to say something like
sql = "DELETE FROM interestingrows WHERE cid in (SELECT cid FROM TABLE2)"
... except the sql cmd is being sent to my adapter which is connect to a foxpro db and "interestingrows" is an oledb table.
It would be very nice, though not absolutely necessary, if the solution will work when we eventually decide to switch underlying database to MS SQL (or whatever customer decides on).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您的评论反馈,您可能想要创建一个指向两个表的公共根文件夹的辅助“连接”...否则我预计您的查询将通过尝试从当前连接所在的位置获得上一级的访问权限而失败...这可能会让你失败。因此,使用新的根连接路径,您的查询可以引用一个查询中的路径和表...类似于...
并且您当前的连接将
创建一个指向的 SECONDARY 连接
然后您的查询可以类似于
Based on your comment feedback, you might want to create a SECONDARY "Connection" that points to the common root folder to both tables... Otherwise I expect your query would fail by trying to gain access one level UP from where the current connection is... It might fail you on that. So, with a new rooted connection path, your query can reference the paths and tables in one query... something like...
and your current connection is going to
create a SECONDARY connection pointing to
Then your query can be something like
直接向基础表发出 SQL 命令怎么样?
How about issuing the SQL command directly to the underlying tables?