OLD与VB中的新数据库技术 [英] OLD vs NEW Database Techniques in VB

查看:74
本文介绍了OLD与VB中的新数据库技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天。



在90年代早期到中期,我使用BTRIEVE(任何人都记得吗?)和Microsoft Quick Basic为本地企业编写了许多程序。然后我使用Access将我的环境移动到Visual Basic作为我首选的数据库存储方法。事实证明,BTRIEVE中用于创建数据库,访问记录,更新记录等的原语与我需要在VB / Access环境中使用的原语非常相似。



我知道VB.net程序使用数据库的已接受方法。但是,我从来没有看到任何使用我的老式方法的引用或文档。作为我所指的一个例子,我在下面列出了一些示例语句,这些语句来自管理Access数据库中数据的VB6程序。



我'我没有尝试就不同数据库,语言等的优点展开辩论。只是问一个简单的问题,即:VB.net是否支持这些老式数据库操作方法,特别是因为它与ACCESS作为数据库有关?



提前感谢您的深思熟虑和内容丰富的考虑因素。





(来自VB / Access程序的示例代码)



 ' 创建数据库对象 
全局 DatabaseDB As 数据库

' 创建工作空间对象
< span class =code-keyword>全球 DatabaseWS As 工作区

' 为数据库中的表创建记录集
全局 DatabaseTable As 记录集

' 打开数据库
设置 DatabaseWS = DBEngine.Workspaces( 0
Set DatabaseDB = DatabaseWS.OpenDatabase(NameOfDatabase)

' OPEN A DATABASE TABLE
设置 DatabaseTable = DatabaseDB.OpenRecordset( DatabaseTableName,dbOpenTable)

' 选择ACCESSIN时使用的索引GA数据库表
DatabaseTable.Index = SomeIndexDefinedInAccess

' 通过数据库表导航
DatabaseTable.MoveFirst ' 基于当前索引的表中第一条记录的位置
DatabaseTable.MoveNext ' 根据当前索引将指针移动到表格中的下一条记录

' 在数据库表中添加新记录
DatabaseTable.AddNew
DatabaseTable( LastName)= Smith
DatabaseTable.Update



等等。

解决方案

< blockquote>你的问题实际上与VB.NET无关,因为你所谈论的一切都是由外部库完成的,甚至是在VB6时代。



什么你问的是 ADO.NET> [ ^ ]是的,一切都得到支持。


Good day all.

In the early to mid-90's I wrote many programs for local businesses using BTRIEVE (anyone remember that?) and Microsoft Quick Basic. Then I moved my environment to Visual Basic using Access as my preferred method of database storage. As it turned out, the primitives used in BTRIEVE to create a database, access records, update records, etc. were extremely similar to those I needed to use in the VB/Access environment.

I am aware of the "accepted" methods for database usage with VB.net programs. However, I've never seen any references or documentation for doing it using my "old fashioned" methods. As an example of what I'm referring to, I have included some sample statements below that are from a VB6 program that manages data in an Access database.

I'm not trying to initiate a debate regarding the merits of different databases, languages, etc. Just asking a simple question, which is: Does VB.net support these "old fashioned" database manipulation methods, specifically as it pertains to ACCESS as the database?

Thank you in advance for your thoughtful and informative considerations.


(Sample code from VB/Access program)

'CREATE A DATABASE OBJECT
Global DatabaseDB As Database

'CREATE A WORKSPACE OBJECT
Global DatabaseWS As Workspace

'CREATE A RECORD SET FOR A TABLE IN THE DATABASE
Global DatabaseTable As Recordset

'OPEN THE DATABASE
Set DatabaseWS = DBEngine.Workspaces(0)
Set DatabaseDB = DatabaseWS.OpenDatabase(NameOfDatabase)

'OPEN A DATABASE TABLE
Set DatabaseTable = DatabaseDB.OpenRecordset("DatabaseTableName", dbOpenTable)

'SELECTING AN INDEX TO USE WHEN ACCESSING A DATABASE TABLE
DatabaseTable.Index = "SomeIndexDefinedInAccess"

'NAVIGATING THROUGH A DATABASE TABLE
DatabaseTable.MoveFirst   'positions at first record in table based on current index
DatabaseTable.MoveNext   'moves pointer to next record in table based on current index

'ADDING A NEW RECORD TO THE DATABASE TABLE
DatabaseTable.AddNew
DatabaseTable("LastName") = "Smith"
DatabaseTable.Update


etc. etc. etc.

解决方案

Your question actually has nothing to do with VB.NET as everything you're talking about is done by external libraries, even back in the VB6 days.

What you're asking about is ADO.NET>[^] and yes, everything is supported.


这篇关于OLD与VB中的新数据库技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆