PC Review


Reply
Thread Tools Rate Thread

DataSource/DataBind

 
 
ThunderMusic
Guest
Posts: n/a
 
      4th Sep 2006
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


 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      4th Sep 2006
Thundermusic,

What has that class to do?

Cor

"ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      4th Sep 2006
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]" <(E-Mail Removed)> a écrit dans le message de
news: (E-Mail Removed)...
> Thundermusic,
>
> What has that class to do?
>
> Cor
>
> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      4th Sep 2006
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.SPAM> schreef in bericht
news:(E-Mail Removed)...
>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]" <(E-Mail Removed)> a écrit dans le message de
> news: (E-Mail Removed)...
>> Thundermusic,
>>
>> What has that class to do?
>>
>> Cor
>>
>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
>> news:(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
Miro
Guest
Posts: n/a
 
      4th Sep 2006
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]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.SPAM> schreef in bericht
> news:(E-Mail Removed)...
>>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]" <(E-Mail Removed)> a écrit dans le message
>> de news: (E-Mail Removed)...
>>> Thundermusic,
>>>
>>> What has that class to do?
>>>
>>> Cor
>>>
>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
>>> news:(E-Mail Removed)...
>>>> 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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      4th Sep 2006
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]" <(E-Mail Removed)> a écrit dans le message de
news: %(E-Mail Removed)...
> 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.SPAM> schreef in bericht
> news:(E-Mail Removed)...
>>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]" <(E-Mail Removed)> a écrit dans le message
>> de news: (E-Mail Removed)...
>>> Thundermusic,
>>>
>>> What has that class to do?
>>>
>>> Cor
>>>
>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
>>> news:(E-Mail Removed)...
>>>> 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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      4th Sep 2006
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.SPAM> schreef in bericht
news:(E-Mail Removed)...
> 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]" <(E-Mail Removed)> a écrit dans le message de
> news: %(E-Mail Removed)...
>> 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.SPAM> schreef in bericht
>> news:(E-Mail Removed)...
>>>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]" <(E-Mail Removed)> a écrit dans le message
>>> de news: (E-Mail Removed)...
>>>> Thundermusic,
>>>>
>>>> What has that class to do?
>>>>
>>>> Cor
>>>>
>>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
>>>> news:(E-Mail Removed)...
>>>>> 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
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      4th Sep 2006
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]" <(E-Mail Removed)> a écrit dans le message de
news: e$WGD%(E-Mail Removed)...
> 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.SPAM> schreef in bericht
> news:(E-Mail Removed)...
>> 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]" <(E-Mail Removed)> a écrit dans le message
>> de news: %(E-Mail Removed)...
>>> 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.SPAM> schreef in bericht
>>> news:(E-Mail Removed)...
>>>>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]" <(E-Mail Removed)> a écrit dans le message
>>>> de news: (E-Mail Removed)...
>>>>> Thundermusic,
>>>>>
>>>>> What has that class to do?
>>>>>
>>>>> Cor
>>>>>
>>>>> "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schreef in bericht
>>>>> news:(E-Mail Removed)...
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSource/DataBind ThunderMusic Microsoft Dot NET 7 4th Sep 2006 07:14 PM
DataSource/DataBind ThunderMusic Microsoft Dot NET Framework 7 4th Sep 2006 07:14 PM
Databind ?? Adam J Knight Microsoft ASP .NET 2 1st Feb 2006 11:10 PM
ComboBox.DataSource .Net v1.1.4322: Problem to assign new datasource Stephan Microsoft Dot NET Framework 3 10th Oct 2003 08:09 AM
cast datagrid.datasource to dataset (datasource is table) newsgroper@yahoo.com Microsoft Dot NET Framework Forms 1 4th Jul 2003 04:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:16 PM.