Solved

import csv >1000 cols

Posted on 2004-09-10
5
430 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

713 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