Solved

removing datacontrol

Posted on 2001-08-02
8
185 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 69

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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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 69

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 69

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now