Click to See Complete Forum and Search --> : Very Urgent. Adding Record using DataGrid


Azhar S
August 23rd, 2001, 01:58 AM
Mastertable- ITEM
Detailed table -ORDER

While displaying data in datagrid
instead of displaying the ITEMCODE from Detailed table I'm displaying ITEMNAME from Master table as per the requirement. Displaying is done fine but when trying to add new record in a Detailed table which contains ITEMCODE as foreign key how can I insert new record using ITEMNAME.

I'm using SQL statement: "select --,--,Itemname from Order,Item where Order.Itemcode=Item.Itemcode."
This displays ITEMNAME instead of ITEMCODE (so that the user can easily recognize the item) in a grid which is bound by ADODC control.
How should I add new record in a grid using ITEMNAME as the user can't remember the ITEMCODE everytime.

I've tried updating using recordset object in beforeupdate event of the grid.
(field values r taken from grid). But as the AllowUpdate option of the grid will be set to true it's saving the same record twice.

Please suggest a solution for this ASAP.