TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
cwarner
NA
1
0
reading a .csv or .txt file into a dataset
Jan 11 2004 11:20 PM
hi, I feel like I've tried every connection string possible to read in a .csv file..... I have copied my current code into this thread, any help would be great! I'm using the microsoft.data.odbc namespace, but if the system.data namespace works OK, I can use that too. If ext.Text = "csv" Then 'Connection string for a Text File Dim connectionstring As String Dim conn2 As New Microsoft.Data.Odbc.OdbcConnection Dim da2 As New Microsoft.Data.Odbc.OdbcDataAdapter Dim dt2 As System.Data.DataTable Dim ds2 As System.Data.DataSet connectionstring = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:\automated auditors\testdata" 'Query the Employees.txt file as a table conn2 = New Microsoft.Data.Odbc.OdbcConnection(connectionstring) Dim SQL As String = "SELECT * FROM invoicescsv.csv" ' Create connection object Dim cmd As New Microsoft.Data.Odbc.OdbcCommand(SQL) cmd.Connection = conn2 ' Open connection conn2.Open() da2 = New Microsoft.Data.Odbc.OdbcDataAdapter("SELECT * FROM invoicescsv.csv", conn2) ds2 = New System.Data.DataSet dt2 = ds2.Tables.Add("invoices") da2.Fill(dt2) conn2.Close() End If Thanks, Christy.
Reply
Answers (
1
)
XSD.exe ---- Can it gereate .cs file from .xsd file
How to print MS PowerPoint usiing C#