When you normally import Excel into Oracle, here's how to summarize:
1. Use OLE mode:
stringConnStr ="provider=microsoft.jet.oledb.4.0;"+"Data source="+ file. xls+"; Extended Properties=excel 8.0"; OleDbConnection Conn=NewOleDbConnection (CONNSTR); Conn. Open (); DataTable DT=NewDataTable (); OleDbDataAdapter Odda=NewOleDbDataAdapter ("select * FROM [sheet1$]", conn); Odda. Fill (DT); returnDt
..... Follow-up action ...
2, first turn Excel into TXT document, in the stream to read, code more, only record the specific steps:
(1) Start the word process to convert Excel to TXT, and then quit Word to delete the Excel file
(2) Use StreamReader to read each line of TXT and then split it to each column with "\ T"
Note: If it is a very standard word segmentation should be no problem, if it is artificial may appear carriage return, then use the system comes with StreamReader to resolve each row, then the problem may occur, at this time my own method is to judge the number of rows, and then get the value of the row
(3) Get the line number, column value, build your own DataTable
(4) Subsequent storage
These two methods from the use of feeling the first more convenient, if it is very standard word so the first convenient, fast; the second slow, but good adaptability, directly to the text file preservation of the original format, suitable for human-built tables
These two methods are used temporarily in the work, if there are new additions in the
C # Methods for importing Excel files to Oracle