Thanks for the help guys , but I am still struggeling here. As I said
I'm new to this and I don't really have the background knowledge
needed.
I am trying to put a total for instance into a textbox. this is my
code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim file As String = "Test.csv"
Dim path As String = "C:\"
Dim ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & _ path & ";Extended
Properties=""Text;HDR=no;FMT=Delimited\"""
Dim conn As New OleDbConnection(ConStr)
Dim qwerty As New OleDb.OleDbCommand("Select count(*) from
test.csv " & file,conn)
TextBox1.Text = qwerty.ExecuteScalar '******BOMBS out
here****
End Sub
Formatting is not great here.
It seems to get as far as running the actual query then crashes. I can
get code like this to work on an .mdb file , but that has collumns
that are named etc. This csv file has nothing like that.If you open
the csv file in Excel the column's are "named" A to P , like a normal
spreadsheet.
I get a feeling my query may be badly structured , although I have
tried
lots of variations with the same result.
I have Microsoft ADO,net step by step , but nowhere does it mention
CSV files.
Any help appreciated
Cheers
Rob
"Cor Ligthert" <no************@planet.nl> wrote in message news:<#R**************@TK2MSFTNGP14.phx.gbl>...
Rob,
Mostly you can read your CSV file into a dataset.
http://groups.google.com/groups?selm...tngp13.phx.gbl
Than you can use within that the datatable.compute to get the total of the
column
http://msdn.microsoft.com/library/de...mputetopic.asp
You will not reads much code in my opinion.
I hope this helps?
Cor
"Rob" <ro****@hotmail.com>
Hi to all.
I am new to Visualbasic.net and windowz programming in general so I hope
someone can help.
I am trying to get info from a csv (Excell) file into a windows form.
For instance I want to get the totals of one "column" and put it into a
textbox on a form when I press a button. I did not think it would be
difficult to do , but I cant seem to get it right.
I have managed to get a datagrid working , using the oledbDataAdapter
,oledbconnection and Dataset stuff on the form with a MSAccess .mdb
file(More by luck than anything else) , but this is not really what I
want.
Has anyone got a simple approch that accesses a csv file on say c:\data
\mycsvfile.csv and puts the total of the first column in a textbox
on a form , when I press a button. If I can get that working , I' may be
able to go from there.
I'm sure some query like: (Select count(*) from myfile.csv where column =
"something " ) , will be needed , but as I said I'm new to this stuff and
I
may be barking up the wrong tree altogether.
Thanks
Rob