Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert  vb6.0 to vb.net 2.0 syntax

Posted on 2009-07-01
1
Medium Priority
?
588 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:RIAS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
mohan_sekar earned 2000 total points
ID: 24754469
Use SQLDataReader for RecordSet and SQLConnection for Connection.

For Do until RsCodes.EOF, use

While reader.Read()
...your stuff
End While

Reset of them should be straightforward.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question