473,401 Members | 2,068 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,401 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 1731
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

20
by: John Spiegel | last post by:
Hi all, I think I've stared at it until it's made me stupid(er?). What am I missing about setting the list of the dropdown to display data pulled from a table? //......
2
by: Jake S | last post by:
Hi all, Is it possibele to set the datasource of a dropdown list to a datareader? When I try to the only column I receive is a column populated by the datasource name repeated the amount of...
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: Narshe | last post by:
If I create a datagrid, and set a source and bind it, the data shows up fine. When a postback occurs, the DataGrid.DataSource == null. Is there something in the web.config I'm missing? This is...
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. ...
3
by: Thirsty Traveler | last post by:
I have a gridview where the datasource is bound after a selection. The result of doing this is that sorting and paging do not work. I was given a sample of how to resolve this, however my attempt...
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...
2
by: shapper | last post by:
Hello, I created a Repeater at runtime with an AccessDataSource.Everything Works fine! Now I need to use the same repeater but with a DataSource created in my VB.Net code. I created a...
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...
2
by: cmrchs | last post by:
Hello, I have a GridView and an objectDataSource <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AllowPaging="True" /> <asp:ObjectDataSource...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.