|
-
Aug 11th, 2010, 04:47 AM
#1
Thread Starter
Member
converting excel file into oracle table/database
hi all
I wish to write small program in vb6 which allow user to upload any excel file to oracle database.
using
Dim Cn as ADODB.Connection
Dim Conn as String
Dim vtblNametxt as String
vtblNametxt= tblNametxt.txt
Cn.Execute(“create table ‘ ” + vtblNametxt + ” ’ (id varchar2(3), pname varchar2(20), qtyp number(4))”)
first row of excel sheet contains the name of the field.
my quetion is how to get and set the attributes of fields from excel like type and length
please help
-
Aug 11th, 2010, 05:45 AM
#2
Re: converting excel file into oracle table/database
-
Aug 12th, 2010, 06:03 AM
#3
Thread Starter
Member
Re: converting excel file into oracle table/database
hi
i got this code from net
Code:
Set cn = New ADODB.Connection
cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + dlgOpenFile.FileName + "';Extended Properties='Excel 8.0';Persist Security Info=False")
Set rs1 = New ADODB.Recordset
rs1.Open cn.OpenSchema(adSchemaTables)
For t = 1 To rs1.RecordCount
strTbl = rs1.Fields("TABLE_NAME").Value
Debug.Print strTbl
Set rs2 = cn.OpenSchema(adSchemaColumns, Array(Empty, Empty, strTbl, Empty))
For c = 1 To rs2.RecordCount
For z = 1 To rs2.Fields.Count
Debug.Print rs2.Fields(z).Value
Sleep 1000
Next z
Next c
Next t
but i am getting rs1.RecordCount as -1
-
Aug 12th, 2010, 09:22 AM
#4
Re: converting excel file into oracle table/database
BEfore you open the recordset, you need to set the cursor location property to aduseClient
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|