Private Sub Form_Load()
' **** Create Connection and Recordset Objects ****
Dim cnConn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strsql As String
' **** Instantiate the new objects ****
Set cnConn = New ADODB.Connection
Set rs = New ADODB.Recordset
' **** Set up connection String ****
With cnConn
.Provider = "SQLOLEDB.1"
.Properties("Data Source").Value = "www"
.Properties("User ID").Value = "clroot"
.Properties("Password").Value = "clroot"
.Properties("Initial Catalog").Value = "iosif"
.CursorLocation = adUseClient
.ConnectionTimeout = 0
.Open
End With
' **** String to pass to the connection to get records back ****
strsql = "select * from salesman"
' **** Open Records for readonly ****
rs.Open strsql, cnConn, adOpenStatic, adLockReadOnly
[B]'Disconnect recordset from db
Set rs.ActiveConnection = Nothing
db.close
set db = nothing
Load DataReport1
Set DataReport1.DataSource = rs
DataReport1.Show
set rs = Nothing[/B]