Home All Groups Group Topic Archive Search About

Data Sources window and data access library

Author
17 Feb 2007 5:31 PM
Flomo Togba Kwele
I am trying to create datasets in a data access class library and use
them in the presentation layer.

To create the dataset, I select the data access class library project in
the Solution Explorer, right-click, Add New and drag a table from the
Server Explorer onto the designer surface. I can see the dataset in the
Solution Explorer and the Class View for the data access class library.
I then rebuild that project.

Then I open a form designer in the presentation layer, open the Data
Sources window, expand the data access class library project in the Data
Sources window, and the newly created dataset is NOT THERE!

What am I missing?

TIA

Author
18 Feb 2007 7:25 AM
RobinS
Show quote
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.2040db73d904249d989682@news.covad.net...
>I am trying to create datasets in a data access class library and use
> them in the presentation layer.
>
> To create the dataset, I select the data access class library project in
> the Solution Explorer, right-click, Add New and drag a table from the
> Server Explorer onto the designer surface. I can see the dataset in the
> Solution Explorer and the Class View for the data access class library.
> I then rebuild that project.
>
> Then I open a form designer in the presentation layer, open the Data
> Sources window, expand the data access class library project in the Data
> Sources window, and the newly created dataset is NOT THERE!
>
> What am I missing?
>
> TIA

It's in the data access layer. If your layers are in separate projects, you
need to create the data source in the right layer.

Robin S.
Author
18 Feb 2007 4:58 PM
Flomo Togba Kwele
That's what I said, Robin, I did create it in the data access layer.
However, it does not show up in that layer in the Data Sources window.

In article <u4idnUyJNO0aYkrYnZ2dnUVZ_s-rn***@comcast.com>,
RobinS@NoSpam.yah.none says...
Show quote
>
> "Flomo Togba Kwele" <flomo@community.nospam> wrote in message
> news:MPG.2040db73d904249d989682@news.covad.net...
> >I am trying to create datasets in a data access class library and use
> > them in the presentation layer.
> >
> > To create the dataset, I select the data access class library project in
> > the Solution Explorer, right-click, Add New and drag a table from the
> > Server Explorer onto the designer surface. I can see the dataset in the
> > Solution Explorer and the Class View for the data access class library.
> > I then rebuild that project.
> >
> > Then I open a form designer in the presentation layer, open the Data
> > Sources window, expand the data access class library project in the Data
> > Sources window, and the newly created dataset is NOT THERE!
> >
> > What am I missing?
> >
> > TIA
>
> It's in the data access layer. If your layers are in separate projects, you
> need to create the data source in the right layer.
>
> Robin S.
>
>
>
Author
19 Feb 2007 3:51 PM
RobinS
I thought you said it didn't show up in the Data Source window when you're
accessing a form in the Presentation (UI) layer.

Robin S.
--------------------------
Show quote
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.20422578e99dc640989683@news.covad.net...
> That's what I said, Robin, I did create it in the data access layer.
> However, it does not show up in that layer in the Data Sources window.
>
> In article <u4idnUyJNO0aYkrYnZ2dnUVZ_s-rn***@comcast.com>,
> RobinS@NoSpam.yah.none says...
>>
>> "Flomo Togba Kwele" <flomo@community.nospam> wrote in message
>> news:MPG.2040db73d904249d989682@news.covad.net...
>> >I am trying to create datasets in a data access class library and use
>> > them in the presentation layer.
>> >
>> > To create the dataset, I select the data access class library project
>> > in
>> > the Solution Explorer, right-click, Add New and drag a table from the
>> > Server Explorer onto the designer surface. I can see the dataset in
>> > the
>> > Solution Explorer and the Class View for the data access class
>> > library.
>> > I then rebuild that project.
>> >
>> > Then I open a form designer in the presentation layer, open the Data
>> > Sources window, expand the data access class library project in the
>> > Data
>> > Sources window, and the newly created dataset is NOT THERE!
>> >
>> > What am I missing?
>> >
>> > TIA
>>
>> It's in the data access layer. If your layers are in separate projects,
>> you
>> need to create the data source in the right layer.
>>
>> Robin S.
>>
>>
>>
Author
19 Feb 2007 4:52 PM
Flomo Togba Kwele
Thanks for replying, Robin.

You are right - I was confused.

When the Solution Explorer is set on the Presentation layer project, I
can see the Data Access layer in the Data Sources window, but the newly
added dataset does not appear in that list.

However, if I select the Data Access layer project in the Solution
Explorer, this changes the display in the Data Sources window. I can see
the newly added dataset. But dragging is disabled when I try to drag the
datatable within the dataset in the Data Sources window onto the
designer surface.

Is this by design? I am not allowed to segregate my data access code
from the presentation layer?

In article <-aydnaT_ZeQYWkTYnZ2dnUVZ_qGjn***@comcast.com>,
RobinS@NoSpam.yah.none says...
Show quote
> I thought you said it didn't show up in the Data Source window when you're
> accessing a form in the Presentation (UI) layer.
>
> Robin S.
Author
19 Feb 2007 9:23 PM
RobinS
Yes, it's by design.

I'm not sure how to segregate the data access code from the UI when you're
using strongly typed data sets.

You could set a reference in your UI that points at the data access layer,
and then call the DAL to load your strongly typed dataset. That's what I
would try.

I use business objects rather than strongly typed datasets, but have mucked
around with them some, which is why I knew the answer to your first
question. :-)

Robin S.
----------------------------------
Show quote
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.204375a0e09eb6d1989685@news.covad.net...
> Thanks for replying, Robin.
>
> You are right - I was confused.
>
> When the Solution Explorer is set on the Presentation layer project, I
> can see the Data Access layer in the Data Sources window, but the newly
> added dataset does not appear in that list.
>
> However, if I select the Data Access layer project in the Solution
> Explorer, this changes the display in the Data Sources window. I can see
> the newly added dataset. But dragging is disabled when I try to drag the
> datatable within the dataset in the Data Sources window onto the
> designer surface.
>
> Is this by design? I am not allowed to segregate my data access code
> from the presentation layer?
>
> In article <-aydnaT_ZeQYWkTYnZ2dnUVZ_qGjn***@comcast.com>,
> RobinS@NoSpam.yah.none says...
>> I thought you said it didn't show up in the Data Source window when
>> you're
>> accessing a form in the Presentation (UI) layer.
>>
>> Robin S.
Author
19 Feb 2007 11:58 PM
Flomo Togba Kwele
Robin,

It's hard for me to believe this is intended behavior, especially since
Brian Noyes, in 'Data Binding with Windows Forms 2.0", stressed
segregating the two layers. But he didn't explain how to do it.

I've been playing a little with objects in addition to datasets - OPF3.
It's interesting.
Author
20 Feb 2007 2:35 AM
RobinS
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.2043d9408d03183d989686@news.covad.net...
> Robin,
>
> It's hard for me to believe this is intended behavior, especially since
> Brian Noyes, in 'Data Binding with Windows Forms 2.0", stressed
> segregating the two layers. But he didn't explain how to do it.
>
> I've been playing a little with objects in addition to datasets - OPF3.
> It's interesting.

Well, I have one friend who's an MVP who does all her stuff with business
objects, and another friend who's an MVP who does all her stuff with
strongly typed datasets. (You'd think these people could agree on a
methodology. ;-)

I thought about asking how she's using her datasets in her UI layer, but
I'm sure that she is defining them in the business layer, and then setting
a reference in her UI layer. It makes sense to me. She might even be
passing them back to her UI layer from her business layer. If you want,
I'll ask her. I want to know, anyway.

Wasn't that Brian Noyes book a great book? One of my favorites. I had a lot
of trouble figuring out how to bind a list of objects to a DataGridView and
then add update capabilities, but after a lot of angst, I finally got it to
work. It turned out if you bind a list of objects to a DataGridView, and
the constructor of your object is not public, the DGV will not enable the
Add option. I found that little nugget of info in Chris Sells' Windows
Forms 2.0 Programming book, luckily *before* I pulled all of my hair out.

Robin S.
Author
19 Feb 2007 12:37 PM
WenYuan Wang
Hi Flomo,

I'm not sure if I have understand the issue completely. I just want to
confirm some information. I understand that you have two
projects(ClassLibrary Project for Data Access Layer, WinForm Project for
Presentation Layer). You have created Typed DataSet in ClassLibrary
Project. But you cannot see it in the WinForm Project. Have I misundstood
anything here?

If this is true, I'm afraid this is by design. The Typed DatSet could only
be seen in ClassLibrary Project which it be created from. We cann't get it
from the other projects, even through they are in the same solution.

Please don't hesitate to correct me if I have misunderstood anything here.
Have a great day!
Sincerely
Wen Yuan
Author
19 Feb 2007 1:51 PM
Flomo Togba Kwele
Thanks for the reply, Wen Yuan.

When I have a blank form displayed in the WinForm project and the Data
Sources window open, I do see the Class Library Project for Data Access
Layer, but the newly created dataset does not show up there.

This view in the Data Source window is consistent with what appears to
be visible when I click on the WinForm Project in the Solution Explorer.
However, when I click on the Data Access Layer in the Solution Explorer,
the view in the Data Source window changes, and I can see the newly
added dataset.

But when I expand the dataset and drag the datatable to the form's
designer surface, the IDE will not allow this - it displays a black
circle with a diagnol line through it.

In article <p3bPGLCVHHA.1***@TK2MSFTNGHUB02.phx.gbl>, v-
wyw***@online.microsoft.com says...
Show quote
> Hi Flomo,
>
> I'm not sure if I have understand the issue completely. I just want to
> confirm some information. I understand that you have two
> projects(ClassLibrary Project for Data Access Layer, WinForm Project for
> Presentation Layer). You have created Typed DataSet in ClassLibrary
> Project. But you cannot see it in the WinForm Project. Have I misundstood
> anything here?
>
> If this is true, I'm afraid this is by design. The Typed DatSet could only
> be seen in ClassLibrary Project which it be created from. We cann't get it
> from the other projects, even through they are in the same solution.
>
> Please don't hesitate to correct me if I have misunderstood anything here.
> Have a great day!
> Sincerely
> Wen Yuan
>
>
Author
19 Feb 2007 3:52 PM
RobinS
That's because they are in different projects. You need to add the data
source to your Presentation layer.

Robin S.
--------------------------------------
Show quote
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.20434ae62a69b026989684@news.covad.net...
> Thanks for the reply, Wen Yuan.
>
> When I have a blank form displayed in the WinForm project and the Data
> Sources window open, I do see the Class Library Project for Data Access
> Layer, but the newly created dataset does not show up there.
>
> This view in the Data Source window is consistent with what appears to
> be visible when I click on the WinForm Project in the Solution Explorer.
> However, when I click on the Data Access Layer in the Solution Explorer,
> the view in the Data Source window changes, and I can see the newly
> added dataset.
>
> But when I expand the dataset and drag the datatable to the form's
> designer surface, the IDE will not allow this - it displays a black
> circle with a diagnol line through it.
>
> In article <p3bPGLCVHHA.1***@TK2MSFTNGHUB02.phx.gbl>, v-
> wyw***@online.microsoft.com says...
>> Hi Flomo,
>>
>> I'm not sure if I have understand the issue completely. I just want to
>> confirm some information. I understand that you have two
>> projects(ClassLibrary Project for Data Access Layer, WinForm Project for
>> Presentation Layer). You have created Typed DataSet in ClassLibrary
>> Project. But you cannot see it in the WinForm Project. Have I
>> misundstood
>> anything here?
>>
>> If this is true, I'm afraid this is by design. The Typed DatSet could
>> only
>> be seen in ClassLibrary Project which it be created from. We cann't get
>> it
>> from the other projects, even through they are in the same solution.
>>
>> Please don't hesitate to correct me if I have misunderstood anything
>> here.
>> Have a great day!
>> Sincerely
>> Wen Yuan
>>
>>
Author
22 Feb 2007 11:39 AM
WenYuan Wang
Hi Flomo,

Many thanks for Robin's reply.

Yes, Flomo. I'm afraid this is by design. They are in different projects.
We are indeed sorry for any inconvenience this may have caused.

By the way, if you really have concern on this, we suggest you may submit
this feedback to our product feedback center. This feature maybe supported
in the next version of Visual Studio.
http://connect.microsoft.com/site/sitehome.aspx?SiteID=210

Please feel free to let me know if there is anything we can help with.
Thanks.
Best regards,
Wen Yuan
Author
22 Feb 2007 6:50 PM
Flomo Togba Kwele
I could not accept the advice I received from all of you, although I am
very appreciative for the responses.

I wrote Brian Noyes and he was so kind to write back. He said, as he did
in his book, "Data Binding with Windows Forms 2.0", that you can have a
dataset in one layer and refer to it in another, thereby separting data
from presentation.

In the data layer project, right-click and add a new dataset. Rebuild
this data layer project.

Now go to your presentation layer and bring up a Designer tab (a Form or
UserControl). In the Data Sources window, Add a New Data Source, or get
there via the Data menu item. Choose Object as your Data Source Type.
Navigate to the Data Layer project and locate the dataset you just
created.

That should do it. Again, thanks so much to Brian Noyes for this tip.
Author
23 Feb 2007 1:00 AM
RobinS
Thanks for posting that. I'm sure people will find it helpful.

Robin S.
---------------------------------
Show quote
"Flomo Togba Kwele" <flomo@community.nospam> wrote in message
news:MPG.204785a036ccd97a98968e@news.covad.net...
>I could not accept the advice I received from all of you, although I am
> very appreciative for the responses.
>
> I wrote Brian Noyes and he was so kind to write back. He said, as he did
> in his book, "Data Binding with Windows Forms 2.0", that you can have a
> dataset in one layer and refer to it in another, thereby separting data
> from presentation.
>
> In the data layer project, right-click and add a new dataset. Rebuild
> this data layer project.
>
> Now go to your presentation layer and bring up a Designer tab (a Form or
> UserControl). In the Data Sources window, Add a New Data Source, or get
> there via the Data menu item. Choose Object as your Data Source Type.
> Navigate to the Data Layer project and locate the dataset you just
> created.
>
> That should do it. Again, thanks so much to Brian Noyes for this tip.
>
Author
23 Feb 2007 4:53 AM
WenYuan Wang
Thanks Flomo, Robin, and Brian Noyes.

This is really helpful. I'm apologize that I can't figure this out in my
reply. I think this is because we referred this dataset to another layer as
Object Data Source, so we can access it. It is really a great solution.
Greatly appreciate you post back the solution.
I'm sure there must be many people will get benefit from this.
For people who want to access the typed dataset from another layer, we can
add the dataset in one layer and refer to it in another layer by Object
Data Source.

Thanks again for your feedback.
Best regards,
Wen Yuan

AddThis Social Bookmark Button