How to use Visual Basic with ADO

xiaoxiao2021-03-06  14

in conclusion

Adovb.exe is a self-despreading file containing the paradigm, which demonstrates how to use ActiveX Data Items (ADO) in Visual Basic.

Other related information

The following files can be downloaded from the Microsoft Download Center. Press the file name below to download the file:

http://download.microsoft.com/download/vb60pro/demo/1/win98/EN-US/Adovb.exe

For additional information about how to download files from the Microsoft Download Center, please refer to the Web URL of the following download center

http://www.microsoft.com/downloads/search.asp

Then press it.

How to use the Microsoft Download Center.

AdodeMo.mdb 332kb 7/28/97 Adovb 18KB 8/5/97 Adovb.vbp 1kb 8/5/97 Adovbex 6kb 7/28/97

AdovB demonstration

ADOVB demonstrates the output and backup parameters (for SQL Server), and enable parameter profiles for Microsoft Access and SQL Server. Also included general models related to the ADO program error handling

Private sub cmdtemplate_click ()

Dim conn1 as adodb.connection

ON Error Goto Vberror 'Trap (Non-Ado) Error / Exceptions

'Create Connection Object (Using Early Binding)

SET CONN1 = New Adodb.Connection

ON Error Goto AdoErrr 'Trap Any Error / Exception

Conn1.connectionstring = AccessConnect

CONN1.OPEN

'----------------------

'Your Code Goes Here!

'----------------------

'Successful Shutdown

Cn1.close

DONE:

'Miscellaneous (graceful) Cleanup

ON Error ResMe next

SET CONN1 = Nothing

EXIT SUB

'Ado Error / Exception Handler

ADOERROR:

'Save Error Information!

Errnumber = err.number

Errsource = Err.Source

Errdescription = err.description

ADOERROREX LIST1, CONN1

'Non-Ado Native Error / Exception Handler

Vberror:

Vberrorex List1, Errnumber, Errsource, ErrDescription

Goto Done

End Sub

note:

• When you use AdovB with ADO 2.0 or updated version, you should remove the reference of Microsoft OLE DB ActiveX Data Objects 1.0 and set to the latest version of Microsoft ActiveX Data Objects. • When you use the ADO 2.0 or update, if the lock type of the ADO data is only read, then when you refer to the OriginalValue property of the ADO field, you will get the following error messages,:

Performance error number '3251': The provider cannot support the job required by the application. To avoid this error in AdovB, display or remove the following code code, that is, cmdaccess from the FRMADOVB program: list1.additem vbtab & "OriginalValue =" & RS1.Fields (i) .Originalvalue

reference

Series of ADO *

This is one of the models in the same example of the ADO in various products, as shown below. These files have the advantages of the same interface / function, and the demonstration is similar and different from different languages ​​/ mechanisms:

172403 How to use Visual Basic with ADO

220152 Sample: Adovc1 Simple ADO / VC Application

185033 File: adoacc.exe Demonstrates Using ADO with Access 97

reference

This document is based on the Microsoft KnowledgeBase file number Q172403 translation. To refer to the original English file content, please contact the following URL:

http://support.microsoft.com/support/kb/articles/q172/4/03.asp

转载请注明原文地址:https://www.9cbs.com/read-48795.html

New Post(0)