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

D

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(CommandBehavior 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
 
O

One Handed Man \( OHM - Terry Burns \)

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

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(CommandBehavior 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
 
D

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 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

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(CommandBehavior 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
 
O

One Handed Man \( OHM - Terry Burns \)

TRY SWAPPING THE DATE FORMAT TO US

--

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

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

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 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

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(CommandBehavior 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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top