473,748 Members | 4,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2609
Thundermusic,

What has that class to do?

Cor

"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU******** ******@TK2MSFTN GP03.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 DataBoundContro l 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

"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU******** ******@TK2MSFTN GP03.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
"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:Oy******** ******@TK2MSFTN GP04.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 DataBoundContro l 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

"ThunderMusi c" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU******* *******@TK2MSFT NGP03.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

ThunderMusi c



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, "VersionTab le", "VersionFie ld", "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******** ********@TK2MSF TNGP06.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
"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:Oy******** ******@TK2MSFTN GP04.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
somethingels e) 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 DataBoundContro l 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...
>>Thundermusi c,

What has that class to do?

Cor

"ThunderMusic " <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU****** ********@TK2MSF TNGP03.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

ThunderMus ic



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************* ***@TK2MSFTNGP0 6.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
"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:Oy******** ******@TK2MSFTN GP04.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
somethingels e) 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 DataBoundContro l 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...
>>Thundermusi c,

What has that class to do?

Cor

"ThunderMusic " <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU****** ********@TK2MSF TNGP03.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

ThunderMus ic



Sep 4 '06 #6
Thundermusic,

Is it this you are after?

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

I hope this helps,

Cor

"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eG******** ******@TK2MSFTN GP02.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************* ***@TK2MSFTNGP0 6.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
"ThunderMusi c" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:Oy******* *******@TK2MSFT NGP04.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,
Dictionarie s, 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 DataBoundContro l 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

ThunderMusi c

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

What has that class to do?

Cor

"ThunderMusi c" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU***** *********@TK2MS FTNGP03.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
>
ThunderMusi c
>




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$************* ***@TK2MSFTNGP0 3.phx.gbl...
Thundermusic,

Is it this you are after?

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

I hope this helps,

Cor

"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eG******** ******@TK2MSFTN GP02.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************* ***@TK2MSFTNGP0 6.phx.gbl...
>>Thundermusi c,

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.h otmail.com.SPAM schreef in bericht
news:Oy****** ********@TK2MSF TNGP04.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
(datasourc e 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
DataBoundCon trol 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

ThunderMus ic

"Cor Ligthert [MVP]" <no************ @planet.nla écrit dans le message
de news: OR************* *@TK2MSFTNGP06. phx.gbl...
Thundermusi c,
>
What has that class to do?
>
Cor
>
"ThunderMus ic" <NO.danlat.at.h otmail.com.SPAM schreef in bericht
news:eU**** **********@TK2M SFTNGP03.phx.gb l...
>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
>>
>ThunderMus ic
>>
>
>




Sep 4 '06 #8

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

Similar topics

2
1620
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 = da.ds_phys.Tables("Physical_Office").Rows dd_phys.DataBind() but this populates my dropdown list with 100 "SYSTEM.DATA.DATAROW"
4
13490
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. I just set the GridView.DataSource once, and call DataBind(); I'd like to drive the application from the GridView control, by including command buttons that allow editing of the data. Starting out simple, I have a DataTable with a boolean...
7
1742
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 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?
5
8018
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 available from 2003 to 2005. Is there some other method available to bind TextBoxes that I am not seeing? I have seen some articles on the web stating that you can only bind to grid and list controls. Seems like a step backward to me. Why would the...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9544
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.