Click here to Skip to main content
15,891,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I want to connect to my database from my application:
I have 2 methods
1. Create dataset and table adapter and ... with object
and drag and dropping field of table on my text boxs or data grid views to show data
2. Create dataset and table adapter and ... with code
Ex. Dim ds as new dataset
or ...
My question is that witch method (1or 2) is better (in be correct, standard, speed of responsibility, ...) and why?
I use VB.Net and Visual Studio and SQL Server in my programming

What I have tried:

How I can Select best method in programming
Posted
Updated 14-Jul-19 1:32am

There is no one best way. It depends on how you like doing it.
 
Share this answer
 
Comments
Amin.Hadizadeh 13-Jul-19 10:20am    
Please guide me more
Which method is more standard
Which method has more efficiency
Which of these two methods is more valid?
Which method is most used in the same conditions
Thanks for your answer
#realJSOP 13-Jul-19 11:04am    
Go back and re-read what I said.
Maciej Los 14-Jul-19 7:06am    
:thumbsup:
Maciej Los 14-Jul-19 7:05am    
The answer is opinion based only. There's nothing like "best method". The best method means the best method for you.
I wrote a DAL object that can translate any database result to any specified entity. This is the best way for my needs. Beyond syntactic rules imposed by the language and framework you're using, pretty much everything you read about programming are to be treated as mere suggestions or guidelines - even when they're called a "best practice".

A good programmer will not only know what his options are when approaching a problem, but he'll be willing and able to implement what works best for the code for a given project. Once he is able to do this, arguments about abstract classes vs interfaces, or returning a dataset or a datatable, or how to implement a threading model fall to the wayside, because decisions have to be made, and the project has to be completed. In other words, you have to make a call, regardless of what other people might think, because YOU are the one writing the code.

Here are some rules I live by:

0) Start all lists with 0 (because real programmers deal with zero-indexed lists on a daily basis.
1) NEVER use a goto. They're evil hold-overs based on based ideas from a less enlightened era.
2) Don't tug on Superman's cape.
3) Don't spit into the wind.
4) Don't pull the mask off that old Lone Ranger.
5) Don't mess around with Jim.

Here's an article from which I think you might benefit.

Being a Programmer[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900