Hi
I have an issue when generate class file, error "Input string was not in a correct format"
Pls advice me
Thank you
Maideen

It is my class.vb file

 Public Function loaddata(inID As Integer, inname As String, inaddress As String, intel As String, infax As String, inemail As String, inregno As String) As String
        '
        Dim data As SqlDataReader
        Dim cmd As New SqlCommand
        cmd = New SqlCommand
        cmd.Connection = conn
        cmd.CommandText = ("usp_CompanyInfo_SelectAll")
        cmd.CommandType = CommandType.StoredProcedure

        loaddata = String.Empty

        conn.Open()
        data = cmd.ExecuteReader()
        loaddata = data.Read
        Try
            inID = data.Item("id")
            inname = data.Item("name")
            inaddress = data.Item("address")
            intel = data.Item("TelNo")
            infax = data.Item("FaxNo")
            inemail = data.Item("email")
            inregno = data.Item("RegNo")

            cmd.Dispose()
            conn.Close()
        Catch ex As Exception
            loaddata = ex.Message.ToString
            conn.Close()
        Finally
            cmd.Dispose()
            conn.Close()
        End Try
        Return loaddata
    End Function

It is asp.page

  Private Sub loaddata()
        Dim errmsg As String
        errmsg = clsCompany.loaddata(Me.txtID.Text, Me.txtName.Text, Me.txtAddress.Text, Me.txtTelNo.Text, Me.txtFaxNo.Text, Me.txtEmail.Text, Me.txtRegNo.Text)

        If errmsg <> String.Empty Then
            ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Error occured : " & errmsg & "');", True)
        Else
            ClearALL()
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Record Saved !');", True)

        End If
    End Sub

Hi,
Put a breakpoint and step into the class in Visual Studio and try to find which line throws the error. Also check the field names enclosed in double quotes between lines 16 and 22 in your code.

Check input order..
It seems to be data type mismatch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.