We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,672 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Oracle Bulk copy

Hello all,
I'm performing the oracle bulk copy upload operation. There are 10 columns data which needs to be uploaded in oracle database table. The data is getting uploaded in the table for these 10 columns using a datatable. A datatable is being populated from the list.
However, there are 2 more columns in the datatable which needs to be uploaded in the same database table. These 2 columns are varchar2(50Byte) columns in database. When I include these 2 columns in the datatable and try to upload it to same database table, it shows the formatting error- "Input string was not in correct format.". The source and the destination columns mapping has been done correctly. The stack trace shows the following error "
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.String.System.IConvertible.ToInt64(IFormatProvider provider)
at System.Convert.ToInt64(Object value)
at Oracle.DataAccess.Client.OracleBulkCopy.PerformBulkCopy()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteDataSourceToServer()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
at Oracle.DataAccess.Client.OracleBulkCopy.WriteToServer(DataTable table)
at InvestorTax.Repository.German.ManufacturedIncomeRepository.OracleBulkUpload(DataTable dtFinal, Dictionary`2 mapping, String tableName) in C:\Documents and Settings\admin\Desktop\upload\bulkupload\DemoBulk\Bulkupload.cs:line 572" "...

It seems that the string columns are being considered as numbers as per the stack trace. Can somebody give me the reason as to why it is happening. Thanks in advance.

2
Contributors
1
Reply
4 Months
Discussion Span
2 Months Ago
Last Updated
3
Views
vinayphadke
Newbie Poster
11 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Input string was not in correct format

It means in there is a valve that doesn't contain a valid integer:

System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

Can somebody give me the reason as to why it is happening. Thanks in advance.

It has something to do with the code you provide it

If you are using a DataGrid then it will probably return the type to you in StringToNumber().

You need to get the Value property instead.

You can also used Int32.TryParse Method:

http://msdn.microsoft.com/en-us/library/f02979c7.aspx

LastMitch
Industrious Poster
4,118 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0592 seconds using 2.67MB