Excel File Format of ".CVS"
Messages   Related Types
This message was discovered on microsoft.public.dotnet.faqs.

Post a new message to this list...

a@b.c
Dear Programmers,

Could anyone send me to the right location to find code/example on how to
take information from Excel File Format of ".CVS" into VB.Net for data
manipulation?

TIA

Kkaptain

Reply to this message...
 
    
_thedebugger
Hi Tia,
I hope you are talking about .CSV and not .CVS.
(CSV is Comma Seperated Values), which is basically text file.

I worked on this earlier, where I have found this...may be usefull to you.

Here is a solution suggested by Elan Zhou (MS) on the
microsoft.public.dotnet.languages.vb newsgroup.

You can also use the following code:
1. Put a DataGrid on the form.
2. Try the following sample code: (Suppose the csv is c:\test.csv.)

Imports System.Data

Imports System.Data.OleDb

Public Class Form1

Inherits System.Windows.Forms.Form

Dim objDataset1 As DataSet()

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim sConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=Text;"

Dim objConn As New OleDbConnection(sConnectionString)

objConn.Open()

Dim objCmdSelect As New OleDbCommand("SELECT * FROM
test.csv", objConn)

Dim objAdapter1 As New OleDbDataAdapter()

objAdapter1.SelectCommand = objCmdSelect

Dim objDataset1 As New DataSet()

objAdapter1.Fill(objDataset1, "Test")

DataGrid1.DataSource = objDataset1.Tables(0).DefaultView

objConn.Close()

End Sub

End Class

<a@b.c> wrote in message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Data.DataSet
System.Data.OleDb.OleDbCommand
System.Data.OleDb.OleDbConnection
System.Data.OleDb.OleDbDataAdapter
System.EventArgs
System.Object
System.Web.UI.WebControls.DataGrid
System.Windows.Forms.DataGrid
System.Windows.Forms.Form




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com