andywks
Posts: 2
|
| Posted: 12/06/2008, 10:52 PM |
|
Dear all, help please. I research CCS for about a month but not yet have the solution yet.
I would like to build master and detail form in 1 page.
Table structure as following:
Master table (ORDER_HEAD)
ORDER_ID
ORDER_DATE
TOTAL_PRICE
Detail table (ORDER_TAIL)
ORDER_ID
LINE_NO
ITEM_DESCRIPTION
PRICE
Just a very simple example here.
I would like to let my user to only key in value for the detail table.
There is no need to show them the Master table as all the value will be control by server side.
What I need to do so when user click on the add button at the detail grid, the system will add 1 row at the master table and then pass the ORDER_ID to the detail grid and process the insert?
Please advise for the solution. Thank you.
|
 |
 |
jacem
Posts: 87
|
| Posted: 12/09/2008, 4:24 PM |
|
In the code for the 'add' button event trigger you might consider doing some sql:
$db = new clsDBMyDatabaseDB();
$SQL = "INSERT INTO master (Name, address,creationdate) "
."VALUES (".$master->Name->Value .",'".$master->Address->Value ."','"
."curdate())";
$db->query($SQL);
echo mysql_error();
//then you can retrive the most recent added ID or search for the ID of the record you added by searching on the field content you added. Again you just need to work out your sql and execute it as above: $db->query($SQL); you can then set the added master id into your detail record so the master detail link is established.
//don't forget to close the sql db
$db->close();
Hope this helps.
|
 |
 |
andywks
Posts: 2
|
| Posted: 12/10/2008, 8:24 PM |
|
Thank you. I think I know what to do.
|
 |
 |
|