Link to home
Start Free TrialLog in
Avatar of ljhodgett
ljhodgett

asked on

Overload resolution failed because no accessible 'Fields' accepts this number of arguments.

Hi Experts,

I have the following code: -

Dim rs As ADODB.Recordset

        Connect()
        rs = conn.Execute("SELECT * FROM config")

        Me.Text = rs!RigTitle
        MyString = rs!SSDNo
        If MyString.Length = 4 And IsNumeric(rs!SSDNo) Then
            TxtSSDNo.Text = rs!SSDNo
        Else
            ErrorNo = 2
        End If

        MyString = rs!RoutingStage
        If MyString.Length = 3 And IsNumeric(rs!RoutingStage) Then
            StageRef = rs!RoutingStage
        Else
            ErrorNo = 3
        End If

        WorkingDatabase = "testdata"
        If WorkingDatabase = "" Then
            ErrorNo = 4
        Else
            AxLogResults1.set_SET_DataBaseName(WorkingDatabase)
        End If

        If Not IsNumeric(rs!comsport890) Then
            ErrorNo = 5
        Else
            CommsPort = CDec(rs!comsport890)
        End If

        If Not IsNumeric(rs!CtrlPort890) Then
            ErrorNo = 6
        Else
            ControlPort = CDec(rs!CtrlPort890)
        End If

        If Not IsNumeric(rs!MeterPort) Then
            ErrorNo = 7
        Else
            MeterPort = CDec(rs!MeterPort)
        End If

        rs.Close()
        conn.Close()


This has been taken from a vb6 program. When I place it into vb.net 2005 I get the error message and an underline on all parts of code that start “rs!” ie, “rs!MeterPort”: -

Overload resolution failed because no accessible 'Fields' accepts this number of arguments.      

What is this please and how do I overcome this. Sorry I’m new to vb.net and currently migrating from vb6.

Many Thanks

Lee


Avatar of appari
appari
Flag of India image

try changing all
rs!

rs.item("fieldname")
or
rs("fieldname")
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada 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