473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

DataSource/DataBind

Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class? I
would like the user to be able to set a data source and I'd like my class to
be able to use this datasource to build a DataTable I could use for further
processing...

Can it be done? if it can, how?

Thanks

ThunderMusic
Sep 4 '06 #1
7 2592
Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class? I
would like the user to be able to set a data source and I'd like my class
to be able to use this datasource to build a DataTable I could use for
further processing...

Can it be done? if it can, how?

Thanks

ThunderMusic

Sep 4 '06 #2
I don't really understand what the purpose of the processing has to do with
how to set a datasource and converting it to a DataTable, but I don't mind
giving a little spoiler on what I'm doing (nobody won't know the overall of
the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names provided by
the user in a property of the object) and display the values of these
columns in graphs and charts...

I know that most bindable controls can receive Arrays, List, SortedList,
Dictionaries, DataTable, DataView, DataSet, et al. All thos controls don't
behave the same at all when it comes to retrieve the data, so I don't want
my objects to always try to find which object I'm working with... If
there's an easy way of doing it, I wanna know... I just don't want to do if
(datasource is DataSet) DoSomething; if (datasource is somethingelse)
DoSomethingElse; and so on... If I can't do without it, I'll do it, but if I
can do without, I'd prefer to do without... ;) and preferably I don't want
to inherit from DataBoundControl because I'm not developing a control yet...
the Data-Bound object is only a class that will be used in many of my
controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message de
news: OR**************@TK2MSFTNGP06.phx.gbl...
Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
>Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class? I
would like the user to be able to set a data source and I'd like my class
to be able to use this datasource to build a DataTable I could use for
further processing...

Can it be done? if it can, how?

Thanks

ThunderMusic


Sep 4 '06 #3
Thundermusic,

In my idea are there only very few controls in WindowForms that can use the
datasource.

That are the ListControls, the DataGrid and the DataGridView
(complex datacontrols)

And that distinct them from the other controls which all can all however
only be binded using the DataBind.

Cor
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:Oy**************@TK2MSFTNGP04.phx.gbl...
>I don't really understand what the purpose of the processing has to do with
how to set a datasource and converting it to a DataTable, but I don't mind
giving a little spoiler on what I'm doing (nobody won't know the overall of
the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names provided
by the user in a property of the object) and display the values of these
columns in graphs and charts...

I know that most bindable controls can receive Arrays, List, SortedList,
Dictionaries, DataTable, DataView, DataSet, et al. All thos controls don't
behave the same at all when it comes to retrieve the data, so I don't want
my objects to always try to find which object I'm working with... If
there's an easy way of doing it, I wanna know... I just don't want to do
if (datasource is DataSet) DoSomething; if (datasource is somethingelse)
DoSomethingElse; and so on... If I can't do without it, I'll do it, but if
I can do without, I'd prefer to do without... ;) and preferably I don't
want to inherit from DataBoundControl because I'm not developing a control
yet... the Data-Bound object is only a class that will be used in many of
my controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message de
news: OR**************@TK2MSFTNGP06.phx.gbl...
>Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
>>Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class?
I would like the user to be able to set a data source and I'd like my
class to be able to use this datasource to build a DataTable I could use
for further processing...

Can it be done? if it can, how?

Thanks

ThunderMusic



Sep 4 '06 #4
Thunder,

I did something similar along what your looking for - ( I think. )

I have created a Class that has a couple properties:
Private DBName As String
Private TableName As String
Private FieldName As String
Private FieldType As String
Private FieldLength As Integer

and to make a long story short it allows me to call a sub that adds this
into an array of the class.
Setup_AddFields(DBFileName, "VersionTable", "VersionField", "StringType", 4)

I then have another sub that loops thru the array and creates the dbfile
name if it doesnt exist,
then it creates the table if it doesnt exist, and then it adds the field,
with the type and length.

Is that something that you are looking for ?

M.


"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Thundermusic,

In my idea are there only very few controls in WindowForms that can use
the datasource.

That are the ListControls, the DataGrid and the DataGridView
(complex datacontrols)

And that distinct them from the other controls which all can all however
only be binded using the DataBind.

Cor
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:Oy**************@TK2MSFTNGP04.phx.gbl...
>>I don't really understand what the purpose of the processing has to do
with how to set a datasource and converting it to a DataTable, but I don't
mind giving a little spoiler on what I'm doing (nobody won't know the
overall of the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names provided
by the user in a property of the object) and display the values of these
columns in graphs and charts...

I know that most bindable controls can receive Arrays, List, SortedList,
Dictionaries, DataTable, DataView, DataSet, et al. All thos controls
don't behave the same at all when it comes to retrieve the data, so I
don't want my objects to always try to find which object I'm working
with... If there's an easy way of doing it, I wanna know... I just don't
want to do if (datasource is DataSet) DoSomething; if (datasource is
somethingelse) DoSomethingElse; and so on... If I can't do without it,
I'll do it, but if I can do without, I'd prefer to do without... ;) and
preferably I don't want to inherit from DataBoundControl because I'm not
developing a control yet... the Data-Bound object is only a class that
will be used in many of my controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message
de news: OR**************@TK2MSFTNGP06.phx.gbl...
>>Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class?
I would like the user to be able to set a data source and I'd like my
class to be able to use this datasource to build a DataTable I could
use for further processing...

Can it be done? if it can, how?

Thanks

ThunderMusic



Sep 4 '06 #5
ok, but this DataBind(), what does it do under the hood? I mean, must it
convert the object datasource into whatever it is in reality? (IEnumerable,
IList, et al.)

thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message de
news: %2****************@TK2MSFTNGP06.phx.gbl...
Thundermusic,

In my idea are there only very few controls in WindowForms that can use
the datasource.

That are the ListControls, the DataGrid and the DataGridView
(complex datacontrols)

And that distinct them from the other controls which all can all however
only be binded using the DataBind.

Cor
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:Oy**************@TK2MSFTNGP04.phx.gbl...
>>I don't really understand what the purpose of the processing has to do
with how to set a datasource and converting it to a DataTable, but I don't
mind giving a little spoiler on what I'm doing (nobody won't know the
overall of the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names provided
by the user in a property of the object) and display the values of these
columns in graphs and charts...

I know that most bindable controls can receive Arrays, List, SortedList,
Dictionaries, DataTable, DataView, DataSet, et al. All thos controls
don't behave the same at all when it comes to retrieve the data, so I
don't want my objects to always try to find which object I'm working
with... If there's an easy way of doing it, I wanna know... I just don't
want to do if (datasource is DataSet) DoSomething; if (datasource is
somethingelse) DoSomethingElse; and so on... If I can't do without it,
I'll do it, but if I can do without, I'd prefer to do without... ;) and
preferably I don't want to inherit from DataBoundControl because I'm not
developing a control yet... the Data-Bound object is only a class that
will be used in many of my controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message
de news: OR**************@TK2MSFTNGP06.phx.gbl...
>>Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...

What is the best way to use the DataSource/DataBind pattern in a class?
I would like the user to be able to set a data source and I'd like my
class to be able to use this datasource to build a DataTable I could
use for further processing...

Can it be done? if it can, how?

Thanks

ThunderMusic



Sep 4 '06 #6
Thundermusic,

Is it this you are after?

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eG**************@TK2MSFTNGP02.phx.gbl...
ok, but this DataBind(), what does it do under the hood? I mean, must it
convert the object datasource into whatever it is in reality?
(IEnumerable, IList, et al.)

thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message de
news: %2****************@TK2MSFTNGP06.phx.gbl...
>Thundermusic,

In my idea are there only very few controls in WindowForms that can use
the datasource.

That are the ListControls, the DataGrid and the DataGridView
(complex datacontrols)

And that distinct them from the other controls which all can all however
only be binded using the DataBind.

Cor
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:Oy**************@TK2MSFTNGP04.phx.gbl...
>>>I don't really understand what the purpose of the processing has to do
with how to set a datasource and converting it to a DataTable, but I
don't mind giving a little spoiler on what I'm doing (nobody won't know
the overall of the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names provided
by the user in a property of the object) and display the values of these
columns in graphs and charts...

I know that most bindable controls can receive Arrays, List, SortedList,
Dictionaries, DataTable, DataView, DataSet, et al. All thos controls
don't behave the same at all when it comes to retrieve the data, so I
don't want my objects to always try to find which object I'm working
with... If there's an easy way of doing it, I wanna know... I just
don't want to do if (datasource is DataSet) DoSomething; if (datasource
is somethingelse) DoSomethingElse; and so on... If I can't do without
it, I'll do it, but if I can do without, I'd prefer to do without... ;)
and preferably I don't want to inherit from DataBoundControl because I'm
not developing a control yet... the Data-Bound object is only a class
that will be used in many of my controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message
de news: OR**************@TK2MSFTNGP06.phx.gbl...
Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl...
Hi,
This question probably went back a couple of times, but I didn't find
anything about it on google, so I ask here...
>
What is the best way to use the DataSource/DataBind pattern in a
class? I would like the user to be able to set a data source and I'd
like my class to be able to use this datasource to build a DataTable I
could use for further processing...
>
Can it be done? if it can, how?
>
Thanks
>
ThunderMusic
>




Sep 4 '06 #7
I dont really see how it can help me, but I'll try to find out...

thanks a lot for your help...

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message de
news: e$****************@TK2MSFTNGP03.phx.gbl...
Thundermusic,

Is it this you are after?

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eG**************@TK2MSFTNGP02.phx.gbl...
>ok, but this DataBind(), what does it do under the hood? I mean, must it
convert the object datasource into whatever it is in reality?
(IEnumerable, IList, et al.)

thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message
de news: %2****************@TK2MSFTNGP06.phx.gbl...
>>Thundermusic,

In my idea are there only very few controls in WindowForms that can use
the datasource.

That are the ListControls, the DataGrid and the DataGridView
(complex datacontrols)

And that distinct them from the other controls which all can all however
only be binded using the DataBind.

Cor
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:Oy**************@TK2MSFTNGP04.phx.gbl...
I don't really understand what the purpose of the processing has to do
with how to set a datasource and converting it to a DataTable, but I
don't mind giving a little spoiler on what I'm doing (nobody won't know
the overall of the project just by this tiny bit anyway)

I must itterate in the rows and find some columns (colums names
provided by the user in a property of the object) and display the
values of these columns in graphs and charts...

I know that most bindable controls can receive Arrays, List,
SortedList, Dictionaries, DataTable, DataView, DataSet, et al. All thos
controls don't behave the same at all when it comes to retrieve the
data, so I don't want my objects to always try to find which object I'm
working with... If there's an easy way of doing it, I wanna know... I
just don't want to do if (datasource is DataSet) DoSomething; if
(datasource is somethingelse) DoSomethingElse; and so on... If I can't
do without it, I'll do it, but if I can do without, I'd prefer to do
without... ;) and preferably I don't want to inherit from
DataBoundControl because I'm not developing a control yet... the
Data-Bound object is only a class that will be used in many of my
controls...

Thanks

ThunderMusic

"Cor Ligthert [MVP]" <no************@planet.nla écrit dans le message
de news: OR**************@TK2MSFTNGP06.phx.gbl...
Thundermusic,
>
What has that class to do?
>
Cor
>
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAMschreef in bericht
news:eU**************@TK2MSFTNGP03.phx.gbl.. .
>Hi,
>This question probably went back a couple of times, but I didn't find
>anything about it on google, so I ask here...
>>
>What is the best way to use the DataSource/DataBind pattern in a
>class? I would like the user to be able to set a data source and I'd
>like my class to be able to use this datasource to build a DataTable
>I could use for further processing...
>>
>Can it be done? if it can, how?
>>
>Thanks
>>
>ThunderMusic
>>
>
>




Sep 4 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul | last post by:
Hi I have a datasource with 1 table, 100 rows, 1 column. I'm trying to populate the drowndown list with the contents of the datasource, dd_phys.DataSource =...
4
by: Jim Katz | last post by:
I have an application that updates a strongly typed data set at run time. I'd like to dynamically create a table that connects to a run time data table. For displaying the data, this works well. ...
7
by: ThunderMusic | last post by:
Hi, This question probably went back a couple of times, but I didn't find anything about it on google, so I ask here... What is the best way to use the DataSource/DataBind pattern in a class? I...
5
by: Ken Varn | last post by:
I have just started using VS.NET 2005 after using VS.NET 2003. One of the things that I noticed is that in ASP.NET, the DataSource property for TextBoxes and other web controls is no longer...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.