Results 1 to 10 of 10
  1. #1

    Default How to Import Excel file to SQL using VB6.0?


    Guyz,

    Unsaon pag import sa excel file..dako kaau nga file mangud.. 40,400 rows..sa excel ako i import sa SQL?
    any sample or idea mga brod?

    Thanks

  2. #2

    Default Re: How to Import Excel file to SQL using VB6.0?

    aw. better migrate to a reliable database.. you can find some conversion tools sa net

  3. #3

    Default Re: How to Import Excel file to SQL using VB6.0?

    Quote Originally Posted by tsunade View Post
    aw. better migrate to a reliable database.. you can find some conversion tools sa net
    Bro...ang excel file mangud ang output report from one of our client then from excel file gusto nko i automate ang pag migrate from excel to SQL using vb6 kay akong mga program is nka vb6 mangud..

    if u have some ideas please kindly share..

    thanks bro.

  4. #4

    Default Re: How to Import Excel file to SQL using VB6.0?

    It is easy to do using .NET but I don't know about VB6. Try to google. I think you need to set your Excel file as a datasource using ODBC or something. Then you read the spreadsheet as you would a normal SQL table.

  5. #5

    Default Re: How to Import Excel file to SQL using VB6.0?

    Code:
     Dim conn As ADODB.Connection
        Dim strSQL As String
        Dim lngRecsAff As Long
    
        Set conn = New ADODB.Connection
        conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=C:\test\sample.xls;" & _
            "Extended Properties=Excel 8.0"
        
        'Import by using Jet Provider.
        
            strSQL = "SELECT * INTO [odbc;Driver={SQL Server};" & _
            "Server=<server>;Database=<database>;" & _
            "UID=<user>;PWD=<password>].XLImport9 " & _
            "FROM [Customers$]"
        
            Debug.Print strSQL
        conn.Execute strSQL, lngRecsAff, adExecuteNoRecords
        Debug.Print "Records affected: " & lngRecsAff
            
        conn.Close
        Set conn = Nothing

  6. #6

    Default Re: How to Import Excel file to SQL using VB6.0?

    Quote Originally Posted by killersmiles View Post
    Guyz,

    Unsaon pag import sa excel file..dako kaau nga file mangud.. 40,400 rows..sa excel ako i import sa SQL?
    any sample or idea mga brod?

    Thanks
    1st naq advice, pag search lang sa google kung naa naba existing nga application for that.

    Anyway, you want to use VB6 para magMigrate sa data from excel to a database (not sure unsa ni nga database imo ginaMean, but anyway, VB6 can connect to if not all, most of the existing database engines.

    In .NET era, dali ra ni iAchieve. In VB6, I'm not that well aware kung unsaon, but my idea is, use the ActiveX/OLE object of excel. to get the data from excel(Pwed mana gamiton sa VB). dn create your customized program to convert and save it to your desired database.

  7. #7

    Default Re: How to Import Excel file to SQL using VB6.0?

    not familiar with VB6, but with .Net dali ra na, himuon ra nmu ug recordset and excel file using ODBC and ma query ra nmu. What if imu i display ang excel file in a flexgrid and then imu dayon kuhaon ang data from the grid to your SQL database??

  8. #8

    Default Re: How to Import Excel file to SQL using VB6.0?

    ako na ng natry bro...but dili ka kaya ang flexgrid sa kadako sa data sa excel...almost 40K,,,

    dali ra i import ang excel file sa vb but the problem is if ma import na nko..dna mao ang files..nagkatibolaag cgru tungod kay dako na kau ang excel file..bcin namo idea ani nga probs...

    Thanks

  9. #9

    Default Re: How to Import Excel file to SQL using VB6.0?

    Quote Originally Posted by killersmiles View Post
    Bro...ang excel file mangud ang output report from one of our client then from excel file gusto nko i automate ang pag migrate from excel to SQL using vb6 kay akong mga program is nka vb6 mangud..

    if u have some ideas please kindly share..

    thanks bro.
    try saving the excel into csv para text format na siya... then look for a code to read csv....or make a regular expression function... from there you can easily save the data into the any database.... the most important thing in the process is getting the data from excel to a array or temporary cache...

    para madali... naay components ana pero im not sure if its a good idea to use since it require the component to where ever you run the application... saving it to csv is the best straight forward and component independent solution

    btw this is my approach to load 1k kabook excel files using VBA

    1) Convert all excel to CSV
    2) Parse CSV and save it into XML
    3) Load the XML and save it to database

    I made an application when i was still working in innodata to compile all the excel files into one spreadsheet, the one made by their programmer similar to the code above took days if not weeks to load all 1k files, my code took only less than 30 minutes... loading a text file is much faster than loading an xls... but im not a programmer in innodata.... sayang giangkon sa way ayong programmer nga mga taphaw ang code... hahahahaha
    Last edited by salbahis; 01-29-2012 at 11:52 PM.

  10. #10
    Junior Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    35

    Default Re: How to Import Excel file to SQL using VB6.0?

    Quote Originally Posted by messerchtmitt View Post
    Code:
     Dim conn As ADODB.Connection
        Dim strSQL As String
        Dim lngRecsAff As Long
    
        Set conn = New ADODB.Connection
        conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
            "Data Source=C:\test\sample.xls;" & _
            "Extended Properties=Excel 8.0"
        
        'Import by using Jet Provider.
        
            strSQL = "SELECT * INTO [odbc;Driver={SQL Server};" & _
            "Server=<server>;Database=<database>;" & _
            "UID=<user>;PWD=<password>].XLImport9 " & _
            "FROM [Customers$]"
        
            Debug.Print strSQL
        conn.Execute strSQL, lngRecsAff, adExecuteNoRecords
        Debug.Print "Records affected: " & lngRecsAff
            
        conn.Close
        Set conn = Nothing
    mao pud ni ako gi gamit sa una, It is possible na wala Microsoft Jet OLEDB library imong PC, but ma download rana nimo sa microsoft na site. Just save the excel file as csv and your ready to go. Let us know pud kung unsa na approach imong gi take, at least we would also know it. Bali knowledge sharing ba.

  11.    Advertisement

Similar Threads

 
  1. Replies: 6
    Last Post: 11-17-2012, 08:49 AM
  2. How to convert swf file to a single swf file?
    By genelleestremos in forum Software & Games (Old)
    Replies: 0
    Last Post: 09-05-2009, 09:58 AM
  3. Best smartphone/celphone to edit excel files
    By ace_ram in forum Gizmos & Gadgets (Old)
    Replies: 4
    Last Post: 09-02-2009, 06:33 AM
  4. how to convert ogg files to avi ??
    By zerk in forum Software & Games (Old)
    Replies: 7
    Last Post: 03-31-2007, 03:27 PM
  5. How to add mp3 file to Motorola V3i via USB.. please help
    By jdimpas in forum Gizmos & Gadgets (Old)
    Replies: 8
    Last Post: 01-30-2007, 08:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top