Re: Some newbie questions
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Mon, 24 Oct 2005 08:59:51 +0200
Hi,
Let me first start with telling, what you don't ask by the way, that there
is not a best or even reaching that method. For reading one value from a
datatabase you can use as well the executescalar, for reading sequential by
instance for a report you can use too the datareader and than there is the
dataadapter.
> 1. For a simple database with a couple of tables do you create a
> dataadapter for each table and then create a dataset that includes each of
> these tables?
>
It is your own choise, both have its pro's and contra's. The designer create
standard for every dataset its own dataadapter, however you are free to use
one and replace everytime the selectcommand, the insertcommand, the
deletecommand and the updatecommand and use one. The last has not any
benefit above using more adapters.
> 2. Do you use the same adapters and datasets througout the application on
> different forms? If so how do you make them available to the other forms
> if
> you have used the wizard to create them?
>
As everything in Net is it again up to you. By instance when I need a
dataset and a selected dataset for by instance a combobox, than I make 2
datasets. One full in columns however few rows and one full(ore selected
with a where clause) and only 3 columns.
> 3. Is it best to reference rows/records by ID number in the table or the
> row index?
>
I don't know how to get records by ID number than by using a find. The last
consumes of course more time than using a row by index. If you mean the
item, than indexing using the column is the quickest.
> 4. Should you link tables in the database using views/queries in the
> database or by creating a separate datatable in the dataset that joins the
> tables from the database?
AFAIK is the relational information from the database not transported to the
dataset. You should create always seperatly your relations and therefore use
as much tables as there are relations.
> 5. Any other advice on best practices for learing this stuff.
>
Start your project with not using stored procedures, those you can implement
very simple forever (and do that) at the end from your project when you know
that everything is right
Use the designer at least to show you how it can be done. A good approach is
to do that not on a form, however in a seperated component that you have
added as item.
For the rest, try and learn from your errors, every sample or book starts to
learn you how to use it, for the rest is your situation the basic how you
make it. Otherwise a simple generator could do everything.
I hope this helps,
Cor
.
- Prev by Date: Re: calling a stored procedure in ADO.NET 2.0
- Next by Date: Re: calling a stored procedure in ADO.NET 2.0
- Previous by thread: Re: Some newbie questions
- Next by thread: Re: Some newbie questions
- Index(es):
Relevant Pages
|