November 30th, 1999, 03:15 PM
I have the names of two fields in a database file. I want to get each entry in each field, and I want to do this without using any controls, just coding. How can I achieve this? Thanks.
|
Click to See Complete Forum and Search --> : Field Contents November 30th, 1999, 03:15 PM I have the names of two fields in a database file. I want to get each entry in each field, and I want to do this without using any controls, just coding. How can I achieve this? Thanks. November 30th, 1999, 03:52 PM In Project, References menu select Microsoft ActiveX Data Objects 2.0 Library. In General Declaration place (Sample works with Sample db Biblio.mdb): private cn as Connection private rs as Recordset In Form_Load event: private Sub Form_Load() Dim FirstField 'you need to decide what type Dim SecondField set cn = new Connection cn.CursorLocation = adUseClient cn.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb;" set rs = new Recordset rs.Open "select Au_ID,Author from Authors", cn, adOpenStatic, adLockOptimistic FirstFileld = rs!Au_ID SecondField = rs!Author 'you have your fields in variables now. 'you can use methods of Recordset object, like MoveNext, MoveLast and so on. Vlad codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |