Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Convert vb6.0 to vb.net 2.0 syntax

Hi,
Can anybody suggest on converting the function from vb6.0 to vb.net 2.0

Cheers
Public Function GetCodes(formid As String) As Boolean
Dim SQL As String
Dim RsCodes As Recordset
Dim rsCodesTable As Recordset
Dim clause As String
'
'identify if the formid has any codes associated with it.
'
SQL = "Select tag,ctrltype from Controls where " & ctUcase & "(formid) = " & UCase(GetSQLValue(formid, ctText)) & _
" AND " & ctUcase & "(Ctrltype) <> " & GetSQLValue("LABEL", ctText)
 
Set RsCodes = OpenRs(SQL, SysDB)
If RsCodes.EOF Or RsCodes.BOF Then
    'no controls associated with this form
Else
    'make a in statement of all fieldnames
    Do Until RsCodes.EOF
        clause = clause & UCase(GetSQLValue(RsCodes!Tag, ctText)) & ", "
        RsCodes.MoveNext
    Loop
End If
If clause <> Empty Then
    clause = UCase(" IN (" & Left(clause, Len(clause) - 2) & ")")
End If
RsCodes.Close
 
If clause <> "" Then
    SQL = "Select Count(*) as Tot FROM Codes WHERE " & ctUcase & "(fieldname) " & clause
    Set rsCodesTable = OpenRs(SQL, MemDB)
    If rsCodesTable!Tot = 0 Then
        GetCodes = False
    Else
        GetCodes = True
    End If
    rsCodesTable.Close
    If GetCodes = True Then
        'if codes exist then exit sub
        Exit Function
    End If
End If
 
 
'
'Secondly - find out if the formid have any links to the codes table
'
SQL = "Select Count(*) as Tot from Controls where formid = " & GetSQLValue(formid, ctText) & " and linktable = 'CODES'"
Set RsCodes = OpenRs(SQL, SysDB)
If RsCodes!Tot = 0 Then
    GetCodes = False
Else
    GetCodes = True
End If
RsCodes.Close
Set RsCodes = Nothing
Set rsCodesTable = Nothing
 
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mohan_sekar
mohan_sekar
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial