Posted on 2000-02-14
Last week was like Christmas around my office. I received a copy of Visual Studio, now I’m really dangerous.
Most of my time has been spent in MS Access and VBA. Now I need to get started connecting to databases, and using recordsets in VB6.
Could someone comment on the example code below that I cut out of an article. I need to know the basics of connecting to a database, and manipulating a recordset.
Dim cn As Connection
Dim ConnStr As String, strSQL As String
Dim rst1 As Recordset
Set cn = New Connection
Set rst1 = New Recordset
cn.CursorLocation = adUseClient
ConnStr = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
" Data Source=C;\My Documents\TestTravel.mdb;" & _
" Jet OLEDB: Database Password=MyPSW"
strSQL = "Select * FROM tblTravelCosts;"
rst1.Open strSQL, cn, adOpenDynamic
rst1.Close: Set rst1 = Nothing
cn.Close: Set cn = Nothing