By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,595 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,595 IT Pros & Developers. It's quick & easy.

Exception: "Input string was not in a correct format."

P: n/a
dan
I am using VB.NET 2003 and SQL Server 2000.

The program uses ADO.NET .

The following instruction:

Me.cd_insertDataRecord.ExecuteNonQuery()
throws this exception:
">>>ProcessDataRecord/ Exception: Type= System.FormatException Message: Input string was not in a correct format.
StackTrace: at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at StoreIrisFiles.Form1.ProcessDataRecord(clsCompany objSender, clsCompany objReceiver, String strRecord) in C:\VS.NET\MyProgs\01-VBcurrent\StoreIrisFiles\Form1.vb:line 553
Source:System.Data"

Command text and type are:

Me.cd_insertDataRecord.CommandText = "p_insertDataRecord"

Me.cd_insertDataRecord.CommandType = System.Data.CommandType.StoredProcedure
The connection is open explicitly.

Who could give me a hint regarding the cause of this exception?

Many thanks,

Dan

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
This is probably something like a Date format which has got an integer in it or something. Basically its telling you that what you tried to insert in the database has data which does not correspond to the type of the field.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"dan" <de*@deamon.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
I am using VB.NET 2003 and SQL Server 2000.

The program uses ADO.NET .

The following instruction:

Me.cd_insertDataRecord.ExecuteNonQuery()
throws this exception:
">>>ProcessDataRecord/ Exception: Type= System.FormatException Message: Input string was not in a correct format.
StackTrace: at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at StoreIrisFiles.Form1.ProcessDataRecord(clsCompany objSender, clsCompany objReceiver, String strRecord) in C:\VS.NET\MyProgs\01-VBcurrent\StoreIrisFiles\Form1.vb:line 553
Source:System.Data"

Command text and type are:

Me.cd_insertDataRecord.CommandText = "p_insertDataRecord"

Me.cd_insertDataRecord.CommandType = System.Data.CommandType.StoredProcedure
The connection is open explicitly.

Who could give me a hint regarding the cause of this exception?

Many thanks,

Dan

Nov 20 '05 #2

P: n/a
dan
That's what I thought.
However:
-all columns are char with one exception which is datetime
-I am printing the value of that parameter and the format is "mm/dd/yyyy"; in other situations that format has been accepted
-I also outcommented that parameter

On the other hand in conversion errors I usually get more explicit and specific messages such as "could not convert @parameter-name to smalldatetime" or something like that.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:uM**************@TK2MSFTNGP09.phx.gbl...
This is probably something like a Date format which has got an integer in it or something. Basically its telling you that what you tried to insert in the database has data which does not correspond to the type of the field.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"dan" <de*@deamon.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
I am using VB.NET 2003 and SQL Server 2000.

The program uses ADO.NET .

The following instruction:

Me.cd_insertDataRecord.ExecuteNonQuery()
throws this exception:
">>>ProcessDataRecord/ Exception: Type= System.FormatException Message: Input string was not in a correct format.
StackTrace: at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at StoreIrisFiles.Form1.ProcessDataRecord(clsCompany objSender, clsCompany objReceiver, String strRecord) in C:\VS.NET\MyProgs\01-VBcurrent\StoreIrisFiles\Form1.vb:line 553
Source:System.Data"

Command text and type are:

Me.cd_insertDataRecord.CommandText = "p_insertDataRecord"

Me.cd_insertDataRecord.CommandType = System.Data.CommandType.StoredProcedure
The connection is open explicitly.

Who could give me a hint regarding the cause of this exception?

Many thanks,

Dan

Nov 20 '05 #3

P: n/a
TRY SWAPPING THE DATE FORMAT TO US

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"dan" <de*@deamon.com> wrote in message news:e6**************@TK2MSFTNGP11.phx.gbl...
That's what I thought.
However:
-all columns are char with one exception which is datetime
-I am printing the value of that parameter and the format is "mm/dd/yyyy"; in other situations that format has been accepted
-I also outcommented that parameter

On the other hand in conversion errors I usually get more explicit and specific messages such as "could not convert @parameter-name to smalldatetime" or something like that.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:uM**************@TK2MSFTNGP09.phx.gbl...
This is probably something like a Date format which has got an integer in it or something. Basically its telling you that what you tried to insert in the database has data which does not correspond to the type of the field.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"dan" <de*@deamon.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
I am using VB.NET 2003 and SQL Server 2000.

The program uses ADO.NET .

The following instruction:

Me.cd_insertDataRecord.ExecuteNonQuery()
throws this exception:
">>>ProcessDataRecord/ Exception: Type= System.FormatException Message: Input string was not in a correct format.
StackTrace: at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at StoreIrisFiles.Form1.ProcessDataRecord(clsCompany objSender, clsCompany objReceiver, String strRecord) in C:\VS.NET\MyProgs\01-VBcurrent\StoreIrisFiles\Form1.vb:line 553
Source:System.Data"

Command text and type are:

Me.cd_insertDataRecord.CommandText = "p_insertDataRecord"

Me.cd_insertDataRecord.CommandType = System.Data.CommandType.StoredProcedure
The connection is open explicitly.

Who could give me a hint regarding the cause of this exception?

Many thanks,

Dan

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.