vb- vb.net ado.net code conversion
can someone help me converting the following code in to vb.net lz plz plz its very urgent
Code:
Sub assess()
Dim db As Database
Dim healthTbl As Recordset
Dim assessmentTbl As Recordset
Dim prepCSITbl As Recordset
Dim prepStltSmtTbl As Recordset
'***********************************
Set db = CurrentDb()
Set assessmentTbl = db.OpenRecordset("APM_Assessment", dbOpenDynaset)
Set healthTbl = db.OpenRecordset("AppID", dbOpenDynaset)
Set prepCSITbl = db.OpenRecordset("Prep_CSI", dbOpenDynaset)
Set prepStltSmtTbl = db.OpenRecordset("Prep_STLT_SMT", dbOpenDynaset)
'-----------------------
' Start to loop through all records
If healthTbl.EOF = True Then Exit Sub
If Not healthTbl.EOF Then healthTbl.MoveFirst ' healthTbl.MoveFirst
If Not assessmentTbl.EOF Then assessmentTbl.MoveFirst ' assessmentTbl.MoveFirst
Do While Not healthTbl.EOF ' Keep on looping until we go beyond the last record
If assessmentTbl.EOF = True Then
assessmentTbl.AddNew
Else
assessmentTbl.Edit
End If
assessmentTbl!AppID = healthTbl!AppID
'''' FIND STLT
prepCSITbl.FindFirst ("AppID = " & healthTbl!AppID)
If Not prepCSITbl.NoMatch Then
prepStltSmtTbl.FindFirst ("SMT = '" & prepCSITbl!SMTLname & "'")
If Not prepStltSmtTbl.NoMatch Then
assessmentTbl!stlt = prepStltSmtTbl!stlt
Else
assessmentTbl!Debug = "NO MAPPING OF STLT"
End If
Else
assessmentTbl!Debug = "NO SMT FOUND IN MAPPING"
End If
assessmentTbl.Update ' Save the contents of the copy buffer to disk
healthTbl.MoveNext ' Make the next record the current record
Loop
End Sub
THANK YOU IN ADVANCE
Re: vb- vb.net ado.net code conversion
Welcome to the forums. :wave:
I edited your post and added [code]your code goes here[/code] tags. When you use them it makes reading and understanding posted code so much easier. :)
Thanks.
In addition, please go through our Into to ADO.NET tutorial.