Solved

Convert  vb6.0 to vb.net 2.0 syntax

Posted on 2009-07-01
1
586 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

738 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