The Provider you use depends on the backend DB that you have. You want to
use the most specific provider available...SQLClient for SQL Server,
OracleClient for Oracle etc.
Now, it's important to identify what's happening. To get data to and from a
Database assuming you are using disconnected methodology, you'll need four
things at a minimum
1) A Connection to the Database (This is the actual Connection Object)
2) A Command (This contains the SQL Statement you want to execute coupled
with the Connection to use to execute that Statement)
3) A DataAdapter (this is what does the Heavy Lifting for you actually
moving the data back and forth)
4) A DataSet or DataTable Hold the data
<This is a bit of an oversimplification b/c there are other objects, but
this is effectively the scenario you have described>
Now, if you use a Join statement, you are going to pull over a whole lot of
data that's redundant. Since the ADO.NET basically creates a client side
representation of your Database (you could have an identical copy or just a
subset), It actually pulls over a copy of all that data. All of the
benefits of normalization are diminished if you are using a Join statement
b/c joins give you redundant data. As such, you can pull over the tables
one at a time and then Relate them using a DataRelation. If you choose this
method, you have effectively 'joined' the tables, the only difference being
that you are doing it client side and only Pulling/Pushing the data that you
need. It's much more efficient to use a DataRelation than pull all of that
data over that you don't need.
Now, you can uses three DataAdapters for instance and fire 3
DataAdapter.Fill statements. Conversely, you can use One DataAdapter ,fire
three different select statements and then use TableMappings to identify
which table is which.
Now, if you use a DataAdapterConfiguration wizard, it will write the
update/insert/select logic for you as long as your tables are keyed (and
Non-Keyed tables are the Computer Equivalent of Satan, and in your case, all
of your tables are keyed). Your next choice is to use a CommandBuilder.
CommandBuilders are rather limiting although they are very convenient for
simple Select and Update scenarios. All you need for a CommandBuilder to
work it's magic is a SELECT Statement, A DataAdapter and a connection. It
will infer the Update/Delete/Insert logic based on the SELECT statement.
Now, if you are using Stored Procedures, forget about the CommandBuilder
(after all, how can it infer Update Logic from a Stored Procedure name?).
the other way to handle it is to hand code your own update logic, but if you
are just starting out....The DataAdapter Configuration Wizard is probably
your best bet.
How would you get the dates? Ok, there are two things you may be doing in
this scenario. First you pull over all of your data and populate your
controls. now, when the user looks for a given data, you can either query
your data locally by querying the DataTable or DataView or you can requery
the Database. Clearly querying the local data is the more 'efficient' in
terms of resource usage, but since its disconnected this may not be an
option depending on how often data is updated.
You can use Parameters from the Command and assign the value of the
DateTimePicker controls to them...
I gave you an example before -- substitute @ArrivalDate with
YourDateTimePicker.Value...
If this is a commercial app, and I say this affectionately, do yourself a
favor and read up on ADO.NET. Bill Vaughn's book
http://www.betav.com/Files/Books/books.htm has saved me many times over and
so has David Sceppa's book
http://www.amazon.com/exec/obidos/t...f=pd_sim_art_elt/104-9506987-0039901?v=glance
is another must have. Buy one or both of them and take a day or two to just
work with the examples. If you are going to put this into production, it's
critical that you really understand what you are doing. You can use the
Wizards and put this thing together, but there are issues related to
concurrency (what happens if users get the same record, make different
changes and submit them at different times? You need to have a strategy to
determine who wins), performance, security that really need to be
understood.
There are some good examples on MSDN and all over the internet, so you can
just search google on the terms DataAdapter, DataView, RowFilter,
CommandBuilder and the other examples mentioned below and you'll get a good
handle on things.
HTH,
Bill