PC Review


Reply
Thread Tools Rate Thread

Beginning the march

 
 
BobAchgill
Guest
Posts: n/a
 
      11th Mar 2005
Why do I get this syntax error for the code below:

SYNTAX ERROR MESSAGE:

'myTableinDS' is not a member of 'System.Data.Dataset'

I know the data set is good because when it is read in it
shows up in my datagrid. Now I just want to march
through the table row by row column by column
programmatically doing things with the table data.

But I don't seem to be able to create the variable
MyTableRows() As DataRow to get this process started.

Many thanks!

Bob

+++++++++++++++++++++++++++

CODE:
Dim myDS As DataSet = New DataSet

myDS.ReadXml("MyData_data.xml")

Dim MyTableRows() As DataRow = myDS.myTableinDS()


Dim myCol As DataColumn
Dim myRow As DataRow


If (MyTableRows.Length < 1) Then
'Console.WriteLine("No Rows Found")
Else
For Each myRow In MyTableRows
For Each myCol In myDS.myTableinDS.Columns
'Console.Write(vbTab & myRow
(myCol).ToString())
Next
Next
End If
 
Reply With Quote
 
 
 
 
Peter Proost
Guest
Posts: n/a
 
      11th Mar 2005
Hi,

what's myTableinDS? Is it a string containing the tablename?

Try this (out of my head so watch typeO's):
Dim myDS As New DataSet
Dim MyTableRows As DataRow
Dim row, col as Integer
myDS.ReadXml("MyData_data.xml")


If (myDS .Tables(myTableinDS).Rows.count =0) Then
'Console.WriteLine("No Rows Found")
Else
For row = 0 to myDS .Tables(myTableinDS).Rows.count -1
For col = 0 to myDS .Tables(myTableinDS).Columns.count -1

'Console.Write(myDS.Tables(myTableinDS).Rows(row).Item(col))
Next
Next
End If


Hth Peter


"BobAchgill" <(E-Mail Removed)> schreef in bericht
news:70c901c52611$0ff967f0$(E-Mail Removed)...
> Why do I get this syntax error for the code below:
>
> SYNTAX ERROR MESSAGE:
>
> 'myTableinDS' is not a member of 'System.Data.Dataset'
>
> I know the data set is good because when it is read in it
> shows up in my datagrid. Now I just want to march
> through the table row by row column by column
> programmatically doing things with the table data.
>
> But I don't seem to be able to create the variable
> MyTableRows() As DataRow to get this process started.
>
> Many thanks!
>
> Bob
>
> +++++++++++++++++++++++++++
>
> CODE:
> Dim myDS As DataSet = New DataSet
>
> myDS.ReadXml("MyData_data.xml")
>
> Dim MyTableRows() As DataRow = myDS.myTableinDS()
>
>
> Dim myCol As DataColumn
> Dim myRow As DataRow
>
>
> If (MyTableRows.Length < 1) Then
> 'Console.WriteLine("No Rows Found")
> Else
> For Each myRow In MyTableRows
> For Each myCol In myDS.myTableinDS.Columns
> 'Console.Write(vbTab & myRow
> (myCol).ToString())
> Next
> Next
> End If



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      11th Mar 2005
Bob,

That it is showed in the datagrid, does not say that it is a dataset, it can
be every IList implementing array or collection however because of the name
probably a DataTable.

I hope this helps

Cor


 
Reply With Quote
 
BobAchgill
Guest
Posts: n/a
 
      11th Mar 2005

Ok.

I plugged in the actual table name that is in my XML
schema into the code you gave me. But now I get the
ERROR:
Name 'IP_addresses' is not declared.

I wonder if this has anything to do with my XML file that
I read in??

We are reading in the the data XML file. Maybe we should
be reading in the associated Schema XML file???
Otherwise how will the IDE know what the table name is?

CODE:

Dim myDS As New DataSet
Dim MyTableRows As DataRow
Dim row, col As Integer
myDS.ReadXml("IP_addresses_data.xml")


If (myDS.Tables(IP_addresses).Rows.count = 0) Then
'Console.WriteLine("No Rows Found")
Else
For row = 0 To myDS.Tables
(IP_addresses).Rows.count - 1
For col = 0 To myDS.Tables
(IP_addresses).Columns.count - 1

'TextBox1.Text = myDS.Tables
(IP_addresses).Rows(row).Item(col)
'Console.Write(myDS.Tables
(myTableinDS).Rows(row).Item(col))
Next
Next
End If
 
Reply With Quote
 
Chris Dunaway
Guest
Posts: n/a
 
      11th Mar 2005
The compiler sees IP_addresses as a *variable name* which is not
defined. If that is the table name, then, perhaps, it should be in
quotation marks?

If (myDS.Tables("IP_addresses").Rows.count = 0 Then
.....

Chris

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2008 Australian Excel Conference - March 12 - March 14, Sydney, Australia Damon Longworth Microsoft Excel Programming 0 15th Feb 2008 03:04 AM
2008 Australian Excel Conference - March 12 - March 14, Sydney, Australia Damon Longworth Microsoft Excel Programming 0 4th Feb 2008 04:17 AM
2008 Australian Excel Conference - March 12 - March 14, Sydney, Australia Damon Longworth Microsoft Excel Misc 0 4th Feb 2008 04:17 AM
2008 Australian Excel Conference - March 12 - March 14, Sydney, Australia Damon Longworth Microsoft Excel Worksheet Functions 0 4th Feb 2008 04:17 AM
2008 Australian Excel Conference - March 12 - March 14, Sydney, Australia Damon Longworth Microsoft Excel Worksheet Functions 0 21st Nov 2007 03:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:08 AM.