Sure, I am using classes in a 3 tier design, and storing my connectionstring in the registry but here is what I am using
my connectionstring in my registry is
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Maytown\Maytown.mdb;Persist Security Info=False
Private Sub Class_Initialize()
m_Connection.Open GetSetting("Maytown", "Login", "ConnectionString"
End Sub
This one updates the record
Public Function Update(ByVal objBusCustomer As clsBusCustomer) As Boolean
On Error GoTo UpdateError
Dim rsRecordset As New Recordset
Dim lngcounter As Long
With rsRecordset
.Open "SELECT * FROM Customers WHERE CustomerID = " & objBusCustomer.CustomerID, m_Connection, adOpenKeyset, adLockOptimistic, 1
If Not .EOF Then
SetRecordFields objBusCustomer, rsRecordset
.Update
.Resync 'this is what I just added but it doesn't work
Update = True
.Close
Else
Err.Raise modErrors.errCustomerNotFound, "clsDBCustomer.Update", "Could not Find Customer."
End If
End With
Set rsRecordset = Nothing
Exit Function
UpdateError:
Update = False
modErrors.ErrorNumber = Err.Number
modErrors.ErrorDescription = Err.Description
modErrors.ErrorSource = Err.Source
End Function
This is what loads my array, which I use in my User object to load the listbox
Public Sub LoadCompanyNameArray(aryCustomers() As String)
'Load the array with a list of customers
Dim rsCustomer As New Recordset
Dim lngcounter As Long
Erase aryCustomers
With rsCustomer
lngcounter = 0
.Open "SELECT Company_Name FROM Customers", m_Connection, adOpenKeyset, adLockOptimistic, 1
Do Until .EOF
lngcounter = lngcounter + 1
ReDim Preserve aryCustomers(lngcounter)
aryCustomers(lngcounter) = !Company_Name
.MoveNext
Loop
.Close
End With
Set rsCustomer = Nothing
End Sub
I know this seems like alot, but it does work, I use this in SQL Server 2000 and it works perfect, so I know it has to be some problem with ADO and the Jet 4.0 Driver.
Thank you,
Adam