Please help me, about make class module to manipulation database
ACCESS (*.mdb), so i can execute SQL statement like SELECT, INSERT, DELETE and UPDATE database itself..

I made my own project sample VB6.0 with no class modules at all, i thought my code/script not very powerfull..

Can you help me??? to make class modules connection, execute and get row data too...

Thank a millions
-andi
:eek:

Recommended Answers

All 2 Replies

Create a class with private members like instances of ADODB.Connection, ADODB.Recordset etc. and with functions which open the Connection, functions which open, manipuate and close the Recordset etc.

Something like:

Option Explicit
Private rs As New ADODB.Recordset
Private conn As New ADODB.Connection


Public Property Let Connection(ByVal vData As ADODB.Connection)
    Set conn = vData
End Property

Public Property Get Connection() As ADODB.Connection
    Set Connection = conn
End Property


Public Property Let Recordset(ByVal vData As ADODB.Recordset)
    Set rs = vData
End Property

Public Property Get Recordset() As ADODB.Recordset
    Set Recordset = rs
End Property

Public Function Initialise(ByVal Connection_string As String, ByVal Recordset_string As String) As clsConnection
    conn.Open Connection_string
    rs.Open Recordset_string, con, adOpenKeyset, adLockOptimistic
    Set Initialise = Me
End Function

Note that this is just a template and may or may not work...I haven't as such tested it. Use it as a reference to create your own class.

Thanks alot,,
How about function to get rows data, execute sql etc..
like SELECT, INSERT, DELETE and UPDATE... in the same class itself

Please add your code SOS ....
Thanks b4 ya

Best Regards
-andi

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.