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!!

Comments

  • : 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!!
    :
    Hi Gicio

    You could use a Dataset.
    In an application environment you arent memory bound like you are in a Website environment.

    The Dataset has great features you can load your whole Database into it. You can even use the Database schema relationships with the dataset.

    Do a search on google.com for C# Dataset you will find to much exaples to ever work through.

    The best practice though is to first decide on your architecture Design a data layer to handle all data transactions between the App and the server.

    Good luck.




  • thanks!!


    another question: Is it possible to select all data from DB with one statement and fill the DataSet?


    gicio
  • :
    :
    : thanks!!
    :
    :
    : another question: Is it possible to select all data from DB with one statement and fill the DataSet?
    :
    :
    : gicio
    :
    Sure you can.
    Take a look at the DataAdapter.
    Once you dragged it onto the form it will give you a dialog box.
    First initialise the connection to the DB
    Use a query if you not using Stored procedures, you can write this or use the query builder to select all the tables you want in your Dataset.

    You will then see the sql in the window.
    Make sure you select * from the tables otherwise you will get a deferred prepare error.
    Finish then right click on the adapter and select create dataset
    Now it creates a typed dataset witch contains the table structure as well as the data from the tables you selected.

    Be warned that this is a removed object Its not real time data cause its not directly linked to the db. Only indirectly through the DataAddapter. Make sure you couver this if you are going to have multiple users on one DB.

    Search Google on C# Dataset you will find some interesting examples.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion