Results 1 to 4 of 4

Thread: converting excel file into oracle table/database

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    41

    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

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: converting excel file into oracle table/database


  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    41

    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

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    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
  •  



Click Here to Expand Forum to Full Width