K
Kevin
I'm trying to convert a VB6 app to VB2005. I'm trying to search for
changes made to a record and record them in a log file. This is my
code in VB6:
Dim X As Long
Dim oField As ADODB.Field
Dim rs as New Adodb.Recordset
pstrSQL = "SELECT * FROM qryCRClasses WHERE fldStudentNumber = '" &
txtStudentNumber & "' AND fldCourseID = " & txtCourseID
rs.Open pstrStudent, db, adOpenStatic, adLockOptimistic, adCmdText
lFieldCount = rs.Fields.Count - 1
'Compare the new record to the one stored in the SavedRecord array
For X = 0 To lFieldCount
Set oField = rs.Fields(X)
If SavedRecord(X).Value <> oField.Value Then
kString = kString & oField.Name & " * " & oField.Value & " |
"
End If
Next
Worked well enough in VB6, but I get the error:
Operator '<>' is not defined for type 'DBNull' and type 'DBNull'
I think I need to use IComparer.Compare Method, but can't quite figure
out the syntax. Does anyone know of an easy way to do this?
changes made to a record and record them in a log file. This is my
code in VB6:
Dim X As Long
Dim oField As ADODB.Field
Dim rs as New Adodb.Recordset
pstrSQL = "SELECT * FROM qryCRClasses WHERE fldStudentNumber = '" &
txtStudentNumber & "' AND fldCourseID = " & txtCourseID
rs.Open pstrStudent, db, adOpenStatic, adLockOptimistic, adCmdText
lFieldCount = rs.Fields.Count - 1
'Compare the new record to the one stored in the SavedRecord array
For X = 0 To lFieldCount
Set oField = rs.Fields(X)
If SavedRecord(X).Value <> oField.Value Then
kString = kString & oField.Name & " * " & oField.Value & " |
"
End If
Next
Worked well enough in VB6, but I get the error:
Operator '<>' is not defined for type 'DBNull' and type 'DBNull'
I think I need to use IComparer.Compare Method, but can't quite figure
out the syntax. Does anyone know of an easy way to do this?