473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Input string was not in a correct format.

ST
Hello, I will be posting 2 errors that I just can't seem to figure out (I'll
put them in different posts). I have looked all over the internet, and I
still can't figure these out! This webapp was working fine, and then all of
a sudden it just "broke"! Thanks in advance for your help!

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 134: connStr.Open()
Line 135: Try
Line 136: c.ExecuteNonQuery()
Line 137: Catch myerr As SqlException
Line 138: txtError.Visible = True

*******MY CODE**********
Imports System.Data.SqlClient

Public Class proteindiagnosis1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents txtDate As System.Web.UI.WebControls.TextBox
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents ddlPM As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label4 As System.Web.UI.WebControls.Label
Protected WithEvents ddlBlot_DR As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents Label6 As System.Web.UI.WebControls.Label
Protected WithEvents ddlBlot_DD As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label7 As System.Web.UI.WebControls.Label
Protected WithEvents txtBlot_DSize As System.Web.UI.WebControls.TextBox
Protected WithEvents Label8 As System.Web.UI.WebControls.Label
Protected WithEvents txtBlot_DQ As System.Web.UI.WebControls.TextBox
Protected WithEvents Label9 As System.Web.UI.WebControls.Label
Protected WithEvents txtBlot_DStain As System.Web.UI.WebControls.TextBox
Protected WithEvents Label10 As System.Web.UI.WebControls.Label
Protected WithEvents ddlBlot_DF As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label12 As System.Web.UI.WebControls.Label
Protected WithEvents Label11 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_DR As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label13 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_DD As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label14 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_DRV As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label15 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_DA1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label16 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_DA2 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label17 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_MR As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label18 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_MA1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label19 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_MA2 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label20 As System.Web.UI.WebControls.Label
Protected WithEvents ddlFlu_AR As System.Web.UI.WebControls.DropDownList
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Protected WithEvents tblImmunoblot As System.Web.UI.WebControls.Table
Protected WithEvents tblImmunoflo As System.Web.UI.WebControls.Table
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents txtError As System.Web.UI.WebControls.Label
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents RegularExpressionValidator2 As
System.Web.UI.WebControls.RegularExpressionValidat or
Protected WithEvents Label21 As System.Web.UI.WebControls.Label
Protected WithEvents txtNotes As System.Web.UI.WebControls.TextBox
Protected WithEvents Label22 As System.Web.UI.WebControls.Label
Protected WithEvents btnBack As System.Web.UI.WebControls.Button
Protected WithEvents btnMain As System.Web.UI.WebControls.Button
Protected WithEvents btnLogOff As System.Web.UI.WebControls.Button

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

End Sub

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim connStr As New SqlConnection(Application("cn"))
Dim c As New SqlCommand
'Either UPDATE or INSERT the information
If Session("update") = "True" Then
c.CommandText = "UPDATE PROTEIN_DIAGNOSIS SET DIAG_DATE=@date,
DYST_RESULT=@DYST_RESULT, DYST_DIAGNOSIS=@DYST_DIAGNOSIS,
DYST_SIZE=@DYST_SIZE, DYST_QUANTITY=@DYST_QUANTITY,
DYST_STAINING=@DYST_STAINING, DYST_ANTIBODY_1=@DYST_ANTIBODY_1,
DYST_ANTIBODY_2=@DYST_ANTIBODY_2, DYST_REVERTANTS=@DYST_REVERTANTS,
MEROSIN_RESULT=@MEROSIN_RESULT, MEROSIN_ANTIBODY_1=@MEROSIN_ANTIBODY_1,
MEROSIN_ANTIBODY_2=@MEROSIN_ANTIBODY_2, ALPHA_SAC_RESULT=@ALPHA_SAC_RESULT,
DYSFERLIN_RESULT=@DYSFERLIN_RESULT, NOTES=@NOTES where procedure_Id = '" &
Session("Procedure_ID") & "' AND protein_diag_method = '" &
ddlPM.SelectedValue & "'"
Session("update") = "False"
Else
c.CommandText = "INSERT INTO PROTEIN_DIAGNOSIS (PROCEDURE_ID,
PROTEIN_DIAG_METHOD, DIAG_DATE, DYST_RESULT,"
c.CommandText &= " DYST_DIAGNOSIS, DYST_SIZE, DYST_QUANTITY,
DYST_STAINING, DYSFERLIN_RESULT,"
c.CommandText &= " DYST_REVERTANTS, DYST_ANTIBODY_1,
DYST_ANTIBODY_2, MEROSIN_RESULT, MEROSIN_ANTIBODY_1, MEROSIN_ANTIBODY_2,
ALPHA_SAC_RESULT, NOTES)"
c.CommandText &= " VALUES (@Proc, @Method, @Date, @DYST_RESULT,
@DYST_DIAGNOSIS, @DYST_SIZE, @DYST_QUANTITY, @DYST_STAINING,
@DYSFERLIN_RESULT,"
c.CommandText &= " @DYST_REVERTANTS, @DYST_ANTIBODY_1,
@DYST_ANTIBODY_2, @MEROSIN_RESULT, @MEROSIN_ANTIBODY_1, @MEROSIN_ANTIBODY_2,
@ALPHA_SAC_RESULT, @NOTES)"
End If
c.Connection = connStr
c.CommandType = CommandType.Text

'Biopsy Pathology Information
c.Parameters.Add("@Proc", SqlDbType.Int).Value =
Session("Procedure_ID")
c.Parameters.Add("@Method", SqlDbType.Char, 20).Value =
ddlPM.SelectedValue
c.Parameters.Add("@Date", SqlDbType.DateTime).Value = txtDate.Text
c.Parameters.Add("@Notes", SqlDbType.VarChar, 255).Value =
txtNotes.Text
If ddlPM.SelectedValue = "IMMUNOBLOT" Then
c.Parameters.Add("@DYST_RESULT", SqlDbType.VarChar, 20).Value =
ddlBlot_DR.SelectedValue
c.Parameters.Add("@DYST_DIAGNOSIS", SqlDbType.VarChar, 20).Value
= ddlBlot_DD.SelectedValue
c.Parameters.Add("@DYST_SIZE", SqlDbType.Int).Value =
txtBlot_DSize.Text
c.Parameters.Add("@DYST_QUANTITY", SqlDbType.Int).Value =
txtBlot_DQ.Text
c.Parameters.Add("@DYST_STAINING", SqlDbType.Int).Value =
txtBlot_DStain.Text
c.Parameters.Add("@DYSFERLIN_RESULT", SqlDbType.VarChar,
20).Value = ddlBlot_DF.SelectedValue
c.Parameters.Add("@DYST_REVERTANTS", SqlDbType.VarChar, 3).Value
= "1"
c.Parameters.Add("@DYST_ANTIBODY_1", SqlDbType.VarChar,
20).Value = "1"
c.Parameters.Add("@DYST_ANTIBODY_2", SqlDbType.VarChar,
20).Value = "1"
c.Parameters.Add("@MEROSIN_RESULT", SqlDbType.VarChar, 20).Value
= "1"
c.Parameters.Add("@MEROSIN_ANTIBODY_1", SqlDbType.VarChar,
20).Value = "1"
c.Parameters.Add("@MEROSIN_ANTIBODY_2", SqlDbType.VarChar,
20).Value = "1"
c.Parameters.Add("@ALPHA_SAC_RESULT", SqlDbType.VarChar,
20).Value = "1"
End If
If ddlPM.SelectedValue = "IMMUNOFLO" Then
c.Parameters.Add("@DYST_RESULT", SqlDbType.VarChar, 20).Value =
ddlFlu_DR.SelectedValue
c.Parameters.Add("@DYST_DIAGNOSIS", SqlDbType.VarChar, 20).Value
= ddlFlu_DD.SelectedValue
c.Parameters.Add("@DYST_SIZE", SqlDbType.Int).Value = DBNull.Value
c.Parameters.Add("@DYST_QUANTITY", SqlDbType.Int).Value =
DBNull.Value
c.Parameters.Add("@DYST_STAINING", SqlDbType.Int).Value =
DBNull.Value
c.Parameters.Add("@DYSFERLIN_RESULT", SqlDbType.VarChar,
20).Value = "1"
c.Parameters.Add("@DYST_REVERTANTS", SqlDbType.VarChar, 3).Value
= ddlFlu_DRV.SelectedValue
c.Parameters.Add("@DYST_ANTIBODY_1", SqlDbType.VarChar,
20).Value = ddlFlu_DA1.SelectedValue
c.Parameters.Add("@DYST_ANTIBODY_2", SqlDbType.VarChar,
20).Value = ddlFlu_DA2.SelectedValue
c.Parameters.Add("@MEROSIN_RESULT", SqlDbType.VarChar, 20).Value
= ddlFlu_MR.SelectedValue
c.Parameters.Add("@MEROSIN_ANTIBODY_1", SqlDbType.VarChar,
20).Value = ddlFlu_MA1.SelectedValue
c.Parameters.Add("@MEROSIN_ANTIBODY_2", SqlDbType.VarChar,
20).Value = ddlFlu_MA2.SelectedValue
c.Parameters.Add("@ALPHA_SAC_RESULT", SqlDbType.VarChar,
20).Value = ddlFlu_AR.SelectedValue
End If

connStr.Open()
Try
c.ExecuteNonQuery()
Catch myerr As SqlException
txtError.Visible = True
txtError.Text = myerr.Message
Finally
connStr.Close()
End Try
'txtError.Visible = True
'txtError.Text = Session("Procedure_ID")
Nov 22 '05 #1
0 837

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
im using asp.net, C# to enter data into a table in sql server...however im getting this error: Input string was not in a correct format. Description: An unhandled exception occurred during the...
0
by: lianfe_ravago | last post by:
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...
5
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
1
by: amitbadgi | last post by:
Welcome back amitbadgi | Logout | Faq Knowledge Discovery Keys COMPUTER PROGRAMMING, DATA MINING, STATISTICS, ARTIFICIAL INTELLIGENCE * Settings * Photos * Lists * MVPs * Forums * Blogs
1
by: amitbadgi | last post by:
I am gettign this error, while migration an app to asp.net Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 19: Dim enddate =...
0
by: hudhuhandhu | last post by:
have got an error which says Input string was not in a correct format. as follows.. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
0
by: Anonieko | last post by:
Are there any javascript codes there? Answer: Yes On the PageLoad event call InitialClientControsl as follows /// <summary> /// This will add client-side event handlers for most of the...
0
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also...
1
by: sehguh | last post by:
Hello folks I have recently been studying a book called "sams teach yourself asp.net 2.0 in24 hours by scott mitchell. I have reached page 614 but when i tried to run an asp page called...
1
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.