Solved

removing datacontrol

Posted on 2001-08-02
8
188 Views
Last Modified: 2010-05-02
I have a usercontrol (2 text boxes + 3 option buttons) that is used in a datarepeater. The fields in the usercontrol are bound to the ADO data control.

My question is - can i bind these fields to a data source class, instead?

Would getting rid of the datacontrol help speed up my app.?

thanks

0
Comment
Question by:jlymn
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
daffyduck14mil earned 75 total points
ID: 6343938
Hi,

Yes, you can bind the textboxes and option buttons to a Data source class. You will loose the ADO Datacontrol, but get a reference to the DataBindings object.

There is a good "how to create your own data source class" in the MSDN library at the location: Visual Studio Documentation, Visual Basic Documentation, Using Visual basic, Programmers Guide, Programming with Objects, creating Data-aware classes.

If it will speed up the execution of your program, I haven't noticed it. What I did notice is a great increase in maintainability, and if you ever want to scale the app to a n-tier sollution, it's a bit easier.

Grtz.©

D.
0
 

Author Comment

by:jlymn
ID: 6344343
i tried the example from msdn, that helped a lot.

Now i can bind the properties to the database fields. The problem is that my new data class isn't visible on the datarepeater's datasource combo list.

This means that i can't get a list of the propertynames and datafields in the repeaterbindings tab (in the property pages of datarepeater)

I assume i need to do this programmatically instead & I see how toi create the object and set datarepeater's datasource to my class, but how do i match each propertyName to a DataField..?







0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6344430
DataControl adds a little overhead. If you replace the datacontrol with a data source class, if strongly beleive that you will loose speed.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:jlymn
ID: 6345131
emoreau - thanks - maybe i should stick with what i've got..? It seems to work ok.

daffy - how will it help with maintainability, to use the dataclass? Is it worth the extra effort do you think?

0
 
LVL 3

Expert Comment

by:daffyduck14mil
ID: 6345187
Hi,

It depends on how large your project is. I can not even begin to imagine the work it will take if you have a 500+ table database (typical goverment database), and didn't do (most) things in a class or something and find out you missed one field name or need to add one later. Ack.. %)

Anyway, if it's small, stick with the ADO control, the class is just one layer less (no graphical control). Imho, it's most of the time not worth the extra effort, but it can come in handy if someone ever needs to work on your program. It's a tradeoff, like most things. Hmm, time to go home, I just started rambling....

Grtz.©

D.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6345310
Are you aware that you can directly bind controls to a recordset using ADO?

Set text1.datasource = rstSomething
text1.datafield = "OneField"
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6357976
Any decisions yet?
0
 

Author Comment

by:jlymn
ID: 6358638
emoreau - I didnt realise you could bind directly without the datacontrol. I'll stick with it this time anyway. It seems easier to use with the datarepeater.

Daffy - Its a small project so i'm going to be lazy and stick with what i've got. Thanks for the input..

Points to daffy and 50 in dummy question for emoreau

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question