Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. import a txt file into MSAccess database and later into SQL server database using C# Code

import a txt file into MSAccess database and later into SQL server database using C# Code

Scheduled Pinned Locked Moved C#
databasecsharpsql-serversysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    new2pgrmg
    wrote on last edited by
    #1

    Hi All, I am trying to import a txt file into MSAccess database and later into SQL server database using C# Code.This is the whole purpose. I have two questions. 1)I have a txt file that has double quotes as field separator.This text contains more than 44lakh lines with morethan 10 columns.I want to import this into an MSAccess database using C# code.I will be having a blank database already created for this purpose.We just have to import the data into this blank database using C# Code.Is it possible,if so how? 2)This is basically a continuation of the previous issue. The file that we imported into MSAccess has to be now imported into SQL server 2005 database using C# code.I tried using BCP(Bulk copy programming),but unfortunatly its not working.So that option is closed now.How can we do this using C# code?Is it possible? Many Thanks

    S 1 Reply Last reply
    0
    • N new2pgrmg

      Hi All, I am trying to import a txt file into MSAccess database and later into SQL server database using C# Code.This is the whole purpose. I have two questions. 1)I have a txt file that has double quotes as field separator.This text contains more than 44lakh lines with morethan 10 columns.I want to import this into an MSAccess database using C# code.I will be having a blank database already created for this purpose.We just have to import the data into this blank database using C# Code.Is it possible,if so how? 2)This is basically a continuation of the previous issue. The file that we imported into MSAccess has to be now imported into SQL server 2005 database using C# code.I tried using BCP(Bulk copy programming),but unfortunatly its not working.So that option is closed now.How can we do this using C# code?Is it possible? Many Thanks

      S Offline
      S Offline
      Spacix One
      wrote on last edited by
      #2

      If you must take it into access: Why not use a text editor, something like gVIM with a :%s/\"/,/g then :%s/,,/,/g command and convert it to a CVS file and do a direct import? Or you could do an indirect import by 1st going into to excel and picking " as your custom split char, but you MUST remember to import as text! Not really a reason to parse this though C# code, as you are just going to make it harder on yourself. Remember the simplest solution is most of the time the better soluiton. The only reason I could see doing this in C# is if you have to process these files many times a day or you wish to learn ADO.NET along the way. The second option doesn't seem viable if you already send Access data into SQL server, so why not modify or fork the program you have to parse the flat file directly into SQL server 2k5?


      -Spacix All your skynet questions[^] belong to solved

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups