Results 1 to 4 of 4

Thread: datagrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    9
    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?

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    82
    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    9

    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

  4. #4
    Lively Member
    Join Date
    Nov 2000
    Location
    NC
    Posts
    66
    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
  •  



Click Here to Expand Forum to Full Width