Help with Data Tables

S

Scott

Ok. Brand new at this so please give a little patience and help me on the
baby steps. I'm rewriting something I did initially in PHP / MySql on a
vb.net / mysql platform. Here's what I'm doing:

1) Data is pulled from the internet and stored to a CSV file
2) Data is loaded into the database with some changes
3) All sorts of data crunching goes on.

Step one works fine -- data is saved to a csv file.
Step 2 -- The data is loaded from a CSV file into a table in a dataset. This
part works fine too. I have added a column to the table once it is full.
Code is:
DS.Tables("CSV").Columns.Add("Symbol")

That works fine too. Now I want to set fill that "Symbol" column with
something of my choosing. This will change regularly. How do I do this? I
have poked around the web for quite some time. I tried using:



Dim TestCmd As New OleDb.OleDbCommand("UPDATE CSV Set Symbol = 'YHOO';")

' testing below

DA.SelectCommand = TestCmd

DS.AcceptChanges()



And that doesn't work at all. Of course I"m very new to ADO.Net and could
use some pointers here. The only tutorials I can find online are how to
create a table from scratch. I want to simply add a column and, if
possible, set the text in all the fields in this column. Eventually, I will
need to know how to take the info from this datatable and dump it into my
database, but that's for later.



Please help! Thanks.



-Scott
 
S

Scott

I guess, on a funamental level, how do I run a standard query against a
datatable in a dataset?
 
C

Cor Ligthert [MVP]

Scott,

A dataset is not a database it is a from a Class instanced Object which is
very much based on OOP.

The DataSet is a collection from Relations and DataTables
A DataTable is a collection from DataColumns and DataRows (The DataColumns
descrive the items)
A DataRow exist from a collection of items.
You can inherit the dataset to give all the parts strongly typed names and
types.

Therefore the first item in the first datatable in the first dataset is

ds.table(0).rows(0).item(0) 'be aware that in this not strongly typed format
is object

I hope this gives an idea

Cor
 
C

Cor Ligthert [MVP]

Scott,

The dataset has some methods to do what you want.

It is the DataTable.Select and the inbuild view the DefaultView.
You can make more DefaultViews and than the name becomes DataView.

There comes something new in version 9.0 what looks like a kind of logical
but free structured query language. The name of that is Linq. You probably
have seen that name already

I hope this helps,

Cor
 
S

Scott

That helped. Seems datatables weren't what I was hoping. I just created a
quick loop to fill in the cells for the recently created column. Now my
goal is to take this info and dump it into a mySql table that may or may not
have duplicates.

Film at 11.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top