Solved

import csv >1000 cols

Posted on 2004-09-10
5
433 Views
Last Modified: 2008-03-06
is there a way to import csv to a temp db with cols > 1000 the csv has no col names. if so how?
0
Comment
Question by:afreer2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 12025632
At this link you can make your csv to a dataset them import it to your Database.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20607244.html
0
 
LVL 3

Expert Comment

by:RacinRan
ID: 12026625
If you are using SQL Server 2000:  

You can use Data Transformation Services (DTS) to import the file directly, bypassing the need to use .Net.  If you need to do this routinely, the DTS package can be scheduled to run by the server.

SQL Server can import 1000 rows per second or two...
0
 
LVL 4

Expert Comment

by:srcalc
ID: 12027440
0
 

Author Comment

by:afreer2
ID: 12031677
I apoligize to all of you for putting my comments in your feedback insted of here. having said that I will try to explain what i'm trying to do.
since i'm new at programing I want to start slow and don't want to add any new things to learn to reach my goal,which is:
a: after I downloaded a csv file I want to automate as much as possibe using (I hope this is the right term) fileDialog to pick the right csv file,there may be many,and put certain rows in many tables. I don't need all the rows all the time because the use of these file may change. Im trying to handicap horses and new ideas may come up and I may want to use the same info in different ways. I don't want to use a server because I only use one computer. The comment from srcalc looks promising but I'd have to learn a lot more to make it work. I also like the idea to use sql to put the info where I want it,but that to will take time for me to learn.
Anyway after I picked a race(csv) that I beleve is a string I can use to put in the program to tell another part of the program what to do with the csv. I don't know if this is clear so I''ll wait for mor input.
thanks again
0
 
LVL 4

Accepted Solution

by:
srcalc earned 500 total points
ID: 12032523
The link I posted earlier amounts to basically this code:

                Dim openDialog As New OpenFileDialog
                openDialog.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"
                openDialog.ShowDialog()
                Dim File As New System.IO.FileInfo(openDialog.FileName)
                Dim DBConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & File.DirectoryName & ";Extended Properties='text;HDR=Yes;FMT=Delimited'")
                Dim DBadapter As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM " & File.Name, DBConnection)
                Dim dTable As New System.Data.DataTable
                DBadapter.Fill(dTable)

This code will make and show an open file dialog box allowing selection of a CSV, then fill a datatable with all the information from the file chosen.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question