ADO Bewerkingen
Gegevens bijwerken (updaten).
Private Function fAuteurBewerk(lngIDAuteur As Long, strANaam As String, strAVoornaam As String, _
strAInfo As String, lngANat As Long, strAGeslacht As String) As Boolean
Dim con As New ADODB.Connection
Dim comUpd As ADODB.Command
Dim strPad As String
Dim strUpd As String
Dim lngAangepast As Long
fAuteurBewerk = False
strPad = "c:\inetpub\wwwroot\Herhaal\App_Data\boek.mdb"
strUpd = "UPDATE tblAuteur SET ANaam = '" & strANaam & "',AVoornaam = '" & strAVoornaam & "',AInfo = '" & strAInfo & "'," _
& " ANat = " & lngANat & ", AGeslacht = '" & strAGeslacht & "' WHERE IDAuteur = " & lngIDAuteur & ";"
Set comUpd = New ADODB.Command
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Properties("Data Source") = strPad
con.Open
comUpd.ActiveConnection = con
comUpd.CommandText = strUpd
comUpd.Execute (lngAangepast)
If con.State = 1 Then
con.Close
End If
fAuteurBewerk = True
End Function
Top
Gegevens toevoegen.
Private Function fWerkToev(lngIDAuteur As Long, strWTitel As String, blnWGelezen As Boolean, lngWAppr As Long, _
lngWGenre As Long, lngWUitgever As Long) As Boolean
Dim con As New ADODB.Connection
Dim comIns As ADODB.Command
Dim strPad As String
Dim strIns As String
Dim lngAangepast As Long
fWerkToev = False
strPad = "c:\inetpub\wwwroot\Herhaal\App_Data\boek.mdb"
strIns = "INSERT INTO tblWerk (IDAuteur,WTitel,WGelezen,WAppr,WGenre,WUitgever) VALUES " _
& "(" & lngIDAuteur & ",'" & strWTitel & "'," & blnWGelezen & "," & lngWAppr & "," & lngWGenre & "," & lngWUitgever & ");"
Set comIns = New ADODB.Command
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Properties("Data Source") = strPad
con.Open
comIns.ActiveConnection = con
comIns.CommandText = strIns
comIns.Execute (lngAangepast)
If con.State = 1 Then
con.Close
End If
fWerkToev = True
End Function
Top
Gegevens verwijderen.
Function fRecordVerwijderen(lngID As Long) As Boolean
Dim con As New ADODB.Connection
Dim comDel As ADODB.Command
Dim strDel As String
strDel = "DELETE * FROM tblTypeKlant WHERE IDTypeKlant = " & lngID
Set con = CurrentProject.Connection
Set comDel = New ADODB.Command
comDel.ActiveConnection = con
comDel.CommandText = strDel
comDel.Execute
If con.State = 1 Then
con.Close
End If
fRecordVerwijderen = True
End Function
Top