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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# & MS SQL 7.0 - Good Code Examples 1

Status
Not open for further replies.

RoguePoet01

Programmer
Oct 1, 2003
302
US
Hi,

We're updating our system and I have to update our GUIs from VB6 to C#.NET.

I've been doing a lot of searching on this. Some say ADO.NET is the way to go as far as interfaces go.

But I'm seeing other examples of code that are using OLEDB, and I see SQLConnect in the Visual Studio Data section of the toolbar.

I know there's more than one way to skin a cat.

With VB6 I was using DAO and recordsets and it just seemed really straight forward and easy.

I was hoping somebody out there would have some advice.

Since we're moving up to C# and .NET, I feel like I have to leave the DAO stuff behind and embrace the future, so to speak.

Would appreciate some thoughts, links, or example code.
 
Yes, if you really move to C# and .NET then leave the DAO and ambrace the beauty of C# and ADO.NET.
C# is expected to be the best language from Microsoft for writing COM+ and Windows based programs offering the folowings benefits:
-Simplicity
-Consistency
-Modernity
-Object-orientation
-Type-safety
-Scalability
-Version support
-Compatibility
-Flexibility

-obislavu-

 
Funny. If C# is so popular, why is this one of the most lame and unhelpful boards I've ever seen?
 
Hold on now - :)
I think your original question is this:

When writing data access code, is it better to use DataSets or custom data access objects (DAOs)?

I am leaning towards actual objects. DataSets are good for a few things, like reporting. But foor the most part are overkill IMHO. So maybe most of your OO knowledge can be ported over. ADO.NET has a lot more than just DataSets to wok with.

You also mention OLEDB. For SqlServer you can use either the OLEDB driver (works with Access, Fox, etc.) or use the Sql Server Native Driver. You will get better performance using the Sql native driver, but the code will only work with MS SqlServer 7.0 and later.

HTH

David
[pipe]
 
Thanks, I appreciate it.

I've done some more searching on the web and again and again the message is to go with ADO for C#.NET.

I'm still learning. Just a little frustrated.

I have found some code (not here) that has gotten me from crawling to walking, but I'm having a tough time finding that eureka example that will get me up and running.

I don't mean to knock Tek-Tips, but this particular board, C#, is nothing compared to the VB6 board.

In fact, so far, it's been all but useless for me.

Maybe with time....
 
I found that it was helpful to view an entire application - to see how everything works, from stored procedure up to the user controls. MS has put up some asp.net examples at I think they are called starter kits. The simplest one is the IBuySpy store, an ecommerce app. I downloaded that and studied it, and copied their pattern without really understanding what I was doing. I have since learned that from an architecture standpoint, it is really a poor example. BUT it is easy for someone new to .NET and especially ADO.NET to follow. I'm sure they planned it that way.

I would even go as far as downloading the "non-Visual Studio" version, just to see how the compiler works in getting it's files and refernces. I found that to be educational in the beginning.

If you need any info on any specific aspect, don't hesitate to ask.

HTH

David
[pipe]
 
I think Microsoft has also made available a data-access layer execution code block on the MSDN site. Sorry, don't know the URL, but if you search on "code block" or "application block" you might find it.

Don't forget that gives you better results than Microsoft's own search engine.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top