I am trying to learn c# and sql server and I am not sure how should I proceed in the following situation:
I have a database with 2 tables: Clients and OrdersFromClients
I am trying to make a form with a listbox in which I will display all the clients found in Clients table.
When I select one client in the listbox I need to display all the orders made by that client and also I want to be able to edit them.
Using SqlDataAdapter and DataSet I know how to retieve the clients from Clients table,
BUT I don't know how to select the orders from the OrdersFromClients table using data from the same DataSet.
(a simple sql command should be something like "SELECT * FROM OrdersFromClients WHERE ClientId = SelectedClientID").
In short I know what does the following code:
DataSet dat_set = new DataSet(); da = new System.Data.SqlClient.SqlDataAdapter(sql_string, con); System.Data.DataSet dat_set = new System.Data.DataSet(); da.Fill(dat_set, "Clients");
BUT I don'w know how to add to dat_set OrdersFromClients data and manipulate them (update, delete or add new orders)
Is there anybody who want to help me ?