|
-
Nov 9th, 2000, 01:42 PM
#1
Thread Starter
New Member
I have a datagrid with data coming from 2 tables which are joined on 1 field. When a new record is inserted into the grid, the datagrid is trying to insert 1 record into each table in the query. I only want the main table to be updated. The same kind of thing happens when a record is deleted. The data is deleted from both tables rather than just the main table. Is there a way to make sure only the data from the main table is affected?
-
Nov 10th, 2000, 07:29 AM
#2
Lively Member
Hi Lisa.
Can you provide a bit more info? Is your DataGrid bound to a Data Control that is the result of a table or SQL call?
If you can post some code on how your DataGrid is established, then we can check it out and see how to solve your problem.
Regards
Adrian.
-
Nov 10th, 2000, 09:19 AM
#3
Thread Starter
New Member
datagrid
Adrian,
You had requested more information about how the data is loaded into the control. Well, I create a recordset (rs in the code below). I have an ADODC control and the recordset of the ADODC control is set to be the recordset I create (rs). The datasource of the grid is set to be the ADODC control. Below I have the basic sqlstr I use to retrieve the data from SQL Server.
cmd.CommandText = "SELECT part_info.id, part_info.bom_id, bom.id, bom.bom_code_id, bom.mfg_pt_id AS 'Manufacturer Part' FROM part_info LEFT JOIN bom ON bom.id = part_info.bom_id WHERE bom.bom_code_id = 2 ORDER BY bom.mfg_pt_id"
rs.CursorLocation = adUseClient
rs.Open cmd, , adOpenStatic, adLockOptimistic
Set ADOBom.Recordset = rs
Thanks for your help.
Lisa
-
Nov 10th, 2000, 05:24 PM
#4
Lively Member
Instead of relying on the grid for deletes and update etc use SQL code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|