Strongly Type Dataset

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Hello
I turned Option Strict on and after I did, I am getting an error of "Option
Explicit does not allow late binding". OK great, now it is time to learn how
to create a strongly typed dataset.

The "tables" I am actually working with are just flat files, but I thought I
would go ahead and create a version of then in SQL Server and then go through
VS and have it create the XSD and the class that I would need to satisfy the
strongly typed dataset. Am I on the right track?

OK now I see the class which was generated for the table.

I did this for all three files that I am going to use, and it created three
classes.

Each class is a dataset, I only need a single dataset...Right? Is there a way
I could have done this to generate a single dataset with three Datatables
contained in the dataset Class?

Now I need to replace the instatiation of my current dataset with this new "ds
Name" class created by the IDE? If I do an "Imports" on the dataset Class
name I can then see the datatable. I then need to change my table constructor
to the new name? Then make all the approriate name changes in the code for
the dataset and table and this will eliminate all of my errors?

If I never intend to use the SQL table and only write out the flat file, there
are probably other things I need to do to fix the class generated....is there
other things I need to do. Is there a better approach to this issue?

Thanks in advance for your assistance!!!!!!!
 
my comments below . . .

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


Jim Heavey said:
Hello
I turned Option Strict on and after I did, I am getting an error of "Option
Explicit does not allow late binding". OK great, now it is time to learn how
to create a strongly typed dataset.
explicitly convert/cast the type using CType or DirectCast

The "tables" I am actually working with are just flat files, but I thought I
would go ahead and create a version of then in SQL Server and then go through
VS and have it create the XSD and the class that I would need to satisfy the
strongly typed dataset. Am I on the right track?

OK now I see the class which was generated for the table.

I did this for all three files that I am going to use, and it created three
classes.

Each class is a dataset, I only need a single dataset...Right? Is there a way
I could have done this to generate a single dataset with three Datatables
contained in the dataset Class?
Yes, you only need one dataset for three tables

Now I need to replace the instatiation of my current dataset with this new "ds
Name" class created by the IDE? If I do an "Imports" on the dataset Class
name I can then see the datatable. I then need to change my table constructor
to the new name? Then make all the approriate name changes in the code for
the dataset and table and this will eliminate all of my errors?
Should do, but when you build it you'll find out

If I never intend to use the SQL table and only write out the flat file, there
are probably other things I need to do to fix the class generated....is there
other things I need to do. Is there a better approach to this issue?

Thanks in advance for your assistance!!!!!!!

It would really help if you described in brief what you were trying to
acheive. Its a little difficult with such little real detail.
 
You needn't create SQL tables to define DataSet. All you need do is to edit
a DataSet in the schema designer. You can drag/drop elements/attributes
from toolbox, but not from sever explorer as you did today.

What do you mean all of your data is in flat files? I guess those are XML
files, right? You need DataSet class to access those data, right? If
those XML files has same root Node, you only need define one DataSet, which
includes three table(elements) on it.
 
Back
Top