codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Input string was not in a correct format... pls help  hudhu_handhu at 04:05 on Wednesday, September 13, 2006
 

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.. :)


  Re: Input string was not in a correct format... pls help  iamrashida83 at 10:40 on Sunday, November 19, 2006
 

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








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Using a Pipe | with a Variable Name!
•  adding audio to html page
•  How to web data base?
•  Re: For better design, please vote!
•  Where jpeg, tiff conventions?
•  Re: Looking to code something.
•  Re: Trying to create a C++ Object Oriented game
•  cant get iframe1 links to load into frame2 HELP please?
•  servlet


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2006