VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This is a class for Doing all the requirements with an ADO Database modify and add the proper refer

by Matthew R (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 3rd February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This is a class for Doing all the requirements with an ADO Database modify and add the proper references in your form and it should work fine

API Declarations


Public Event movecomplete()

Rate This is a class for Doing all the requirements with an ADO Database modify and add the proper refer



'create the variables to make the new connection
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
'Actually open the connection so that we can get the initial recordset
db.Open "provider=msdasql;dsn=atn;database=lala;"

'We have opened the connection now lets specify the recordset
Set adoprimaryRS = New Recordset
adoprimaryRS.Open "select depnum,depname from lala", db, adOpenStatic, adLockOptimistic
DataMembers.Add "Primary"
End Sub
Public Sub addnew()
adoprimaryRS.addnew
End Sub
Private Sub class_getdatamember(datamember As String, data As Object)
Select Case datamember
    Case "Primary"
        Set data = adoprimaryRS
End Select
End Sub
Public Sub delete()
adoprimaryRS.delete
movenext

End Sub
Public Sub movenext()
If Not adoprimaryRS.EOF Then adoprimaryRS.movenext
If adoprimaryRS.EOF And adoprimaryRS.RecordCount > 0 Then
    Beep
    'you can't move to past EOF
    adoprimaryRS.movelast
End If
End Sub
Public Sub moveprevious()
If Not adoprimaryRS.BOF Then adoprimaryRS.moveprevious
If adoprimaryRS.BOF And adoprimaryRS.RecordCount > 0 Then
Beep
'you moved past the BOF
adoprimaryRS.movefirst
End If
End Sub
Public Sub movelast()
adoprimaryRS.movelast
End Sub
Public Sub movefirst()
adoprimaryRS.movefirst
End Sub
Public Sub update()
With adoprimaryRS
    .UpdateBatch adAffectAll
    If .EditMode = adEditAdd Then
    movelast
    End If
End With
End Sub
Public Sub cancel()
With adoprimaryRS
    .CancelUpdate
    If .EditMode = adEditAdd Then
    movefirst
    End If
End With
End Sub

Download this snippet    Add to My Saved Code

This is a class for Doing all the requirements with an ADO Database modify and add the proper refer Comments

No comments have been posted about This is a class for Doing all the requirements with an ADO Database modify and add the proper refer. Why not be the first to post a comment about This is a class for Doing all the requirements with an ADO Database modify and add the proper refer.

Post your comment

Subject:
Message:
0/1000 characters