Table Name is Typed DataSet

  • Thread starter Thread starter Robert A. Boudra
  • Start date Start date
R

Robert A. Boudra

I'm working through one of the example data sets in the Visual Basic
Resource Kit, and am having a problem with use of a table name that contains
spaces. The section of code in the example that I'm having trouble with is
as follows:

TextBox1.Text = tds.Alphabetical_list_of_products(5).ProductName
TextBox2.Text = tds.Alphabetical_list_of_products(5).CategoryName

where tds is a Typed Data Set. I noticed that the actual view in the
Northwind database does not contain the "_" characters between words in the
name. When I enter the code (above) from the example, I get an error saying
"
Alphabetical_list_of_products is not a member of 'tds.dsProducts'. I'm
guessing that the problem has to do with the embedded "_" characters which
are not in the actual view name that the Typed DataSet is based on.
However, it doesn't work if I remove the "_" characters because it doesn't
know how to handle the spaces. Can someone fill me in on how to deal with
this issue? Thanks,

Bob
 
Robert A. Boudra said:
TextBox1.Text = tds.Alphabetical_list_of_products(5).ProductName
TextBox2.Text = tds.Alphabetical_list_of_products(5).CategoryName

Which example are you referring to? I tried to find it but I didn't.
 
For some reason, once I saved the project, it started working. Sorry that
you had to look into this. One question though. It appears that if spaces
are embedded in a View name, they can be repaced by the "_" character to
reference the view in code. Is this correct?

The example is in the Step-by-Step Walkthroughs in the Data Access section.
It is called "Create and Use a Typed DataSet by Using Visual Basic.NET"

Thanks for your help.

Bob
 
Robert A. Boudra said:
For some reason, once I saved the project, it started working. Sorry
that you had to look into this. One question though. It appears
that if spaces are embedded in a View name, they can be repaced by
the "_" character to reference the view in code. Is this
correct?

Blanks are replaced by "_" when the typed dataset is generated because names
mustn't contain blanks.
The example is in the Step-by-Step Walkthroughs in the Data Access
section. It is called "Create and Use a Typed DataSet by Using Visual
Basic.NET"

Aaah ok. I had the explorer search all *.vb files, not *.htm. :-( :-)
 
Back
Top