Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB & C#

Status
Not open for further replies.

vbguy805

Programmer
Oct 17, 2006
23
0
0
US
I am new to c#. I have been using vb before. Uptil now the way I used to write code was using unbound controls so that I can manipulate logic the way I want. I would always build 3-tier applications using this technique.

Now c# and ADO.Net is totally new to me. I have seen many ADO/ADO.NET samples/tutorials over the net. Everyone have different style of writing code. I am just wondering if any one have come up with better solution for using ADO so that can be easily implemented for both ADO & ADO.NET still can build 3-tier applications? What is normal practise you guys use, using bound controls or unbound controls? What is good way to write 3-tier applications in c#?
 
vbGuy,

Where I work, we always develop using a 3-tier (MVC) architecture. Whether your controls are bound to data or not, a 3-tiered application will have User Interface Logic, Business Logic, and Database Manipulation logic.

The UI Layer should really only Accept user input, display data, and validate entered data. The business logic layer should handle any data manipulation that needs to take place. And, the Database Manipulation layer should only handle DB (or in some cases file) connections and executing queries/stored procedures. Assuming the this method is followed, there should never be a direct call to the Database from the UI or the Business Logic.

As for easily implementing ADO or ADO.NET, these are things that should go into the Database Manipulation layer, and so should not have any bearing on how your other layers work. In essence, you should be able to change the way you connect to your database every day and never have any impact on your other tiers.

Long story short, 3-tier architecture is language independent (so the style that worked for you in VB should work for you in C#) and binding data to controls in the UI tier is a matter of preference...personally I like to bind data whenever possible so I can avoid having to loop through lists of data and manually add.

Good luck!
-Kevin

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
Thank you.Mainly I wanted to know is the preference what people normally would use. I just want to know what is standard practice using bound controls or unbound controls in the industry. Or using data adaptes,datasets,readers where they intented to use. or just just datasets every where. ( I dont know lot abt ADO.Net yet)
 
Personally, DataBinding to me is annoying when using regular controls.

You can create your own controls that use custom binding which is a good way to display data. Keeps it out of that monster that MS calls a datagrid.

For the most part though, I tend to not use binding. Personal preference.
 
I find that binding is good for prototypes and one-offs. When writing it "for real", I don't bind.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thank you guys for feed back. I wish more ppl could share this information.
 
Although recently I havent been doing much with db's - I have heard other developers hate the Microsoft way of using databound controls - they prefer to use 3 tier, maybe they're old fashioned and we should all be aboard the good ship "Databound Contols" - I dont know for sure - but to my mind it makes sense to use the 3 tier model - it keeps things 'clean' and surely allows more flexibility??
 
I also think same. Now the question is if you don't go "Microsoft" way,
1>do you loose advantages of new functionality or whatever they trying to push?
2>May be you wont loose advantages of new functionality or whatever now but might loose in future if you still go old way?
3>When Microsoft inventing new things, they dont have 3-tier(it would be better if i call it old way) in their mind??
4>How comfortable are programmers to use new stuff...
 
Sounds like we are doing someone’s college work here?

Age is a consequence of experience
 
During the days of COM-ADO, when we speak of databinding, that normally mean the data getting posted straight to the backend database. With ADO.Net databinding, this is no longer the case. You bind the controls in a local cache (eg. DataSet), with the cache not knowing where the data came from. So, even if you do or don't use databinding, whichever you prefer, it should not compromise your 3-tier design. :)

About databinding, I have nothing against it, in fact, it's one of the things I personally find MS has done a great job with. But considering the complex mechanism/logic behind to make it work, I would rather stay the manual way (keeps me in command of my code. :p)

To answer your questions,

#1, 2, & 4 ) Some stuffs are nice to have, but not necessarily good to use. Depends on that "(new) stuff". Like generics in 2.0, I love 'em so I use them where ever needed. But the login component on ASP.NET 2.0, I just saw the preview. It's nice. That's all. :)

3) I don't get the question. (?)

PS.
You can also implement a stateless COM-ADO Recordset, though it requires a bit of coding. But it's not as portable as ADO.NET's Dataset. :)


[wink] just my opinion
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top