|
I am getting another one of those errors which do not come up during the compile time but come out when i run the script..
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 247: Dim jobRemID, benID, curID, freqID As Integer
Line 248: Dim validNow As Integer = 1
Line 249: Dim jobAmount As Decimal = JobInformation.GetJobAmt(classiDDL.SelectedValue)
Line 250: Dim occupantAmount As Decimal = jobAmount
Line 251: Dim reason As String
Source File: \\hera\webroot$\veyo\chits\CCLChits\CreateCCLChit.aspx.vb Line: 249
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:249
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
it says in the stack trace that the input string wasnt in the correct format.. but the getJobAmt function returns a decimal value and i cant see where i am wrong.. The getJobAmt function is as follows
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 salary
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)
Try
salary = command.ExecuteScalar
If salary Is System.DBNull.Value Then
salary = 0
End If
Catch ex As Exception
Utilities.LogError(ex.ToString)
End Try
VEYOConnection.Close_VEYO_Connection(connection)
Return salary
End Function
So could anyone plz point out to me what is going on???
Thanks in advance.. :)
|
|
|
a dropdownlist always returns a value of string type not an integer it'd b returning e.g. 23 but dat value wud be a string type "23" not integer
try this
Dim jobAmount As Decimal = JobInformation.GetJobAmt(Convert.ToInt32(classiDDL.SelectedValue))
hope this'd resolve ur problem
Regards,
Rashida Jabeen http://www.akaas.net
|
|
|
|
|
|
|
|