Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

importing a .csv file to dataset

Posted on 2006-05-23
7
Medium Priority
?
254 Views
Last Modified: 2010-04-07
Can anybody please suggest me how to import data from a .csv file into a vb.net dataset
0
Comment
Question by:trips001
  • 4
4 Comments
 
LVL 7

Accepted Solution

by:
ExpertAdmin earned 2000 total points
ID: 16791062
You just need to specify the proper connection string for an Excel file when you connect.

Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../ExcelData.xls") " & "Extended Properties=Excel 8.0;"

You can then query each sheet as if it were a table in a database:

SELECT *
FROM Sheet1
WHERE MyCol = 1

This article may help:

http://support.microsoft.com/?id=311731

M@
0
 
LVL 7

Expert Comment

by:ExpertAdmin
ID: 16791069
Oops...

In your case....


Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../ExcelData.csv") " & "Extended Properties=Excel 8.0;"

M@
0
 
LVL 7

Expert Comment

by:ExpertAdmin
ID: 17051881
Well, one respondent with the code needed...looks like my points to me :)

M@
0
 
LVL 7

Expert Comment

by:ExpertAdmin
ID: 17085587
Thank you.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

572 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