March 2nd, 2003, 05:10 PM
|
#1 (permalink)
| | Member
Join Date: Oct 2002
Posts: 71
| ADO.NET and Relational Data problem.....how start?
Hi!
I will write an application that work with an Access DB.
My database have 5 table that have a relationship to each other.
tables in DB:
Table 1: Car: CarID, Manufactore, Colour, Hp, Displacement, Price, Model
Table 2: SaleContractCar: SaleContractID, CarID
Table 3: SaleContract: SaleContractID, CustomerID, Date
Table 4: Customer: CustomerID, CustomerAddressID, Tel, Age, SeconCar, Name
Table 5: CustomerAddress: CustomerAddressID, Street, StreetNr, Zip, City
relationship between the tables:
Table 1 (one to more) Table 2
Table 2 (more to one) Table 3
Table 3 (more to one) Table 4
Table 4 (more to one) Table 5
at this moment I don't know how to start.
should I first load all tables I one DataSet?
and create for each table a DataTable?
how I should start?
how I should write an update SQL statement for this DataSet?
where I can find some sample application that work with Relational Data?
thx!! |
| |
March 3rd, 2003, 12:36 AM
|
#2 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
It depends on what you are looking to do with the data. One thing is, as far as the update statement, you really write it for the Data Adapter, not the DataSet. If you drop the Data Adapter onto the form, it will create the Update command for you, if it can (won't be able to if the underlying DB doesn't have a primary key).
I am thinking that you will be using this to enter in data, using parent/child data entry concepts. In the case of Access, this would be somewhat difficult for me as far as creating new records. If you entered a parent record, then wanted to add child records to it, you wouldn't know which record you created in the parent table. This is easily resolved in SQL Server using a stored procedure to get the ID back, but Access is different.
If I was you, I would use the Data Form Wizard and look at the code they generate, and use some of the concepts from that. |
| |
March 3rd, 2003, 03:55 PM
|
#3 (permalink)
| | Member
Join Date: Oct 2002
Posts: 71
|
thanks!!
another question: Is it possible to select all data from DB with one statement and fill the DataSet?
gicio |
| |
March 3rd, 2003, 08:56 PM
|
#4 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
That would depend on how the db is setup. If you used a Join statement to select it, then it probalby wouldn't be updatable. And you might not have proper columns to join some tables on as well. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |