Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Excel file and inserting records in Oracle table

Status
Not open for further replies.

geetapm

Programmer
Feb 12, 2002
17
IN
Hi to all,

I want to read Excel file, and insert those records in
Oracle table thru VB programming.

Can anyone thru light in this matter.

Thanx.
 
On the assunmption that the Excel file is in a database type format(i.e. fieldname is first row, data in following rows), then I think I would extract the data by connecting using ADO whilst also connecting to Oracle using another ADO connection to insert the data

I have done a similar thing the opposite way and it all worked fine

Andy



 
yes Andy

My excel file is in database format only,
can u give me the sample code for this.

Thanx,
Geeta
 
Sorry I havent got any code handy

I think it might be best to use ADO via ODBC, so first set up odbc connections to both the excel file and the Oracle db

The connection then looks something like this

Private Sub connecttoExcel()
Dim cnexcel As New ADODB.Connection 'connection #1 to excel
Dim rsexcel As ADODB.Recordset 'recordset to work with
cnexcel.Open ("DSN=Excel") 'reference to the excel odbc dsn
Set rsexcel = cnexcel.Execute("select fieldname from ['sheetname$']")' replace fieldname and sheetname with those in your file (I think the sheetname needs to be formatted as shown)

end sub

Then do a similar connection to the oracle db then maniuplate the data between the two connections

Andy


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top