Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts

    import CSV to SQL DB Using asp

    Hi guys, is there anyone can help or any one can give me idea about importing CSV to DB using asp? Looking forward. THanks

    Jerus
    remanythm

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    I don't know any way to do a bulk insert, but it's possible to open a CSV file as an ADODB recordset. From there you can get the data into an array using getRows(), and loop through it running INSERT statements against your target database. It's not the fastest method in the world (I'm running something similar on our intranet against an MSSQL db and the quickest I can get it down to is about 14 inserts a second), but it works:

    Code:
    sFileConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDataDirectory;Extended Properties=""text;HDR=No;FMT=Delimited"""
    sFileSQL = "SELECT * FROM [myfile.csv]"

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi spudhead nice to see u again, iam importing csv file to my webhosting db. it should be a webbased...i have to attach the file then upload button on it.
    remanythm

  • #4
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts

  • #5
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    This one also
    http://www.webmasterworld.com/forum47/1217.htm

    hope this will help..

  • #6
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    iam importing csv file to my webhosting db. it should be a webbased...i have to attach the file then upload button on it.
    Doesn't your host have a control panel or database front end?

  • #7
    New Coder
    Join Date
    Jan 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts
    There is a CSV import wizard on the sql webbased for my hosting, there is no front end...i just like to create a combox to upload the csv file and submit to the db of my hosting web.
    remanythm


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •