0% found this document useful (0 votes)
32 views

Pregătirea: Crearea Unei Referinţe

1. The document discusses creating a reference to Microsoft ActiveX Data Objects (ADO) in a Visual Basic project and creating a data source connection to an Access database. 2. It provides examples of using ADO to open a Recordset on a table in the database, retrieve fields from the Recordset, and move between records. 3. The final example saves the current Recordset bookmark before moving to the next record, then restores the bookmark before closing the Recordset.

Uploaded by

Flutur Raluca
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Pregătirea: Crearea Unei Referinţe

1. The document discusses creating a reference to Microsoft ActiveX Data Objects (ADO) in a Visual Basic project and creating a data source connection to an Access database. 2. It provides examples of using ADO to open a Recordset on a table in the database, retrieve fields from the Recordset, and move between records. 3. The final example saves the current Recordset bookmark before moving to the next record, then restores the bookmark before closing the Recordset.

Uploaded by

Flutur Raluca
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

Lab.

1
Pregtirea
Crearea unei referine
Pai: ADO-Microsoft ActiveX Data Object 1. n Visual Basic E itor-! Project E"#lorer $. %ools -! &eferences '. Available &eferences -! bifa(i Microsoft ActiveX Data Objects $.) *ibrar+ ,. O&e.ultatul e vi.ibil /n fi0ura 1

1i0ura 1. Activarea ADO

Crearea unei surse de date


$ 2eto e:

a3Di2 conn As 4onnection 5et conn64urrentProject.4onnection b3 1. 4ontrol Panel-!A 2inistrative %ools-!Data 5ources 7ODB43 $. 5+ste2 D58-!A -!4reate 8e9 Data 5ource

'. 5elect:2 Microsoft Access Driver 7.2 b3 -! 1inis;

,.Data 5ource 8a2e-nu2ele noii surse e ate7nu2ele #e care-l vo2 folosi in VBA3 <. A :u0:2 o escriere =. 4lic> #e 5elect...

4lic> O). O-

?.O-

Lucrul cu nregistrri din baza de date


Exemplu 1: @@@@@@@@@@@@@@@@@@@@@@@@@@@ Private Sub Command0_Click() Dim rs As ecordset Set rs ! Create"b#ect($AD"D%& ecordset$) rs&"pen $clienti$' $ba(a$ rs&Close )Set rs ! *ot+in, End Sub @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Exemplu -: ................................... Private Sub Command0_Click() Dim rs As ecordset Dim strSE/EC0 As Strin, Set rs ! Create"b#ect($AD"D%& ecordset$) strSE/EC0 ! $SE/EC0 1 2rom clienti3$ rs&"pen strSE/EC0' $ba(a$' ad"pen4e5set rs&Close Set rs ! *ot+in, End Sub @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Exemplu 6: ....................................... Private Sub Command0_Click() Dim rs As ecordset Dim strSE/EC0 As Strin, Set rs ! Create"b#ect($AD"D%& ecordset$) strSE/EC0 ! $SE/EC0 1 2rom clienti3$ rs&"pen strSE/EC0' $ba(a$' ad"pen4e5set 7s,%ox rs(1) 8 $'$ 8 rs($adresac$) rs&Close Set rs ! *ot+in, End Sub @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Exemplul 9: Private Sub Command0_Click() Dim rs As ecordset Dim strSE/EC0 As Strin, Dim salvat As :ariant Set rs ! Create"b#ect($AD"D%& ecordset$) strSE/EC0 ! $SE/EC0 1 2rom clienti3$ rs&"pen strSE/EC0' $ba(a$' ad"pen4e5set 7s,%ox rs(1) 8 $'$ 8 rs($adresac$) rs&7ove 7s,%ox rs(1) 8 $'$ 8 rs($adresac$) salvat ! rs&%ookmark

rs&7ove ;1 7s,%ox rs(1) 8 $'$ 8 rs($adresac$) )rs&7ove 1' salvat )7s,%ox rs(1) 8 $'$ 8 rs($adresac$)

rs&%ookmark ! salvat 7s,%ox rs(1) 8 $'$ 8 rs($adresac$)

rs&Close Set rs ! *ot+in, End Sub

You might also like