HELP needed in solving a run time error in ASP.NET

Discussion in 'Software' started by hudhu_handhu, Sep 13, 2006.

  1. hudhu_handhu


    Sep 13, 2006
    Likes Received:
    Hi everyone..

    I need some urgent help in settling a problem i have come across whilst doing a project using ASP.NET and VB.NET..
    I am getting a run time error as follows..

    Input string was not in a correct format.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    Line 235: Dim validNow As Integer = 1
    Line 236: 'Dim jobAmount As Decimal = JobInformation.GetJobAmt(classiDDL.SelectedValue)
    Line 237: Dim jobAmount As Decimal = Convert.ToDecimal(JobInformation.GetJobAmt(classiDDL.SelectedValue))
    Line 238: Dim occupantAmount As Decimal = jobAmount
    Line 239: Dim reason As String

    Source File: \\hera\webroot$\veyo\chits\CCLChits\CreateCCLChit.aspx.vb Line: 237

    Stack Trace:

    [FormatException: Input string was not in a correct format.]
    Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +195
    Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +95

    [InvalidCastException: Cast from string "" to type 'Integer' is not valid.]
    Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +210
    veyo.CreateCCLChit.NextButton1_Click(Object sender, EventArgs e) in \\hera\webroot$\veyo\chits\CCLChits\CreateCCLChit.aspx.vb:237
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain() +1292

    The associated code for the getJobAmt is posted below..

    Public Shared Function GetJobAmt(ByVal classID As Integer) As Decimal
    ' Author: Fathimath Sidana
    ' Date: 11 September 2006
    Dim connection As SqlConnection
    Dim command As SqlCommand
    Dim strQuery As String
    Dim salaryAmt

    strQuery = "SELECT salary FROM tbl_classificationSalaries WHERE (classID = @classID) AND (validNow=1)"

    connection = VEYOConnection.Open_VEYO_Connection()
    command = VEYOConnection.Get_VEYO_Command(strQuery, connection)

    command.Parameters.Add("@classID", classID)
    salaryAmt = command.ExecuteScalar
    If salaryAmt Is System.DBNull.Value Then
    salaryAmt = 0
    End If
    Catch ex As Exception
    End Try

    Return salaryAmt
    End Function

    So if anyone could plz help out.. i would b really grateful :angel:
    hudhu_handhu, Sep 13, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.