469,954 Members | 1,759 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

Help with Data Tables

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
Mar 19 '06 #1
4 1240
I guess, on a funamental level, how do I run a standard query against a
datatable in a dataset?
Mar 19 '06 #2
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
"Scott" <sc***@scott.scott> schreef in bericht
news:jq******************************@comcast.com. ..
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

Mar 19 '06 #3
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

"Scott" <sc***@scott.scott> schreef in bericht
news:Ds******************************@comcast.com. ..
I guess, on a funamental level, how do I run a standard query against a
datatable in a dataset?

Mar 19 '06 #4
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.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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
"Scott" <sc***@scott.scott> schreef in bericht
news:jq******************************@comcast.com. ..
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


Mar 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by EMW | last post: by
3 posts views Thread by Datatable Dataset Datagrid help | last post: by
5 posts views Thread by manmit.walia | last post: by
5 posts views Thread by Sam | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.