我在Access中查询4个表,然后修改数据,如下:
 Query.SQL.Add('SELECT DISTINCT DeviceBaseInfo.Device_Name,DeviceBaseInfo.Device_ID,'+
                              'DeviceBaseInfo.Device_IP,DeviceBaseInfo.Device_MAC,'+
                              'DeviceBaseInfo.Device_Password,DeviceBaseInfo.Device_TypeID,'+
                              'DeviceBaseInfo.Device_PlaceID,DeviceBaseInfo.Device_ControlPort,'+
                              'DeviceTypeInfo.DeviceType_name,'+
                              'DeviceTypeInfo.DeviceClass_name,'+
                              'DeviceBaseInfo.Device_IPMask,DeviceBaseInfo.Device_GateWay,'+
                              'DEVICE_IpcameraAppendInfo.IPCAMERA_MULTIDESTIP ,'+
                              'DEVICE_IpcameraAppendInfo.IPCAMERA_MULTIDESTVIDEOPORT ,'+
                              'DEVICE_IpcameraAppendInfo.IPCAMERA_MULTIDESTAUDIOPORT ,'+
                              'DEVICE_IpcameraAppendInfo.IPCAMERA_RECEIVEAUDIOPORT ,'+
                              'DEVICE_TvWallAppendInfo.TVWALL_AUDUIBASEPORT,'+
                              'DEVICE_TvWallAppendInfo.TVWALL_VIDEOBASEPORT,'+
                              'DEVICE_TvWallAppendInfo.TVWALL_WORKMODE '+
                    ' FROM DEVICE_TvWallAppendInfo right join '+
                              '(DEVICE_IpcameraAppendInfo right join'+
                              '(DeviceTypeInfo inner join'+
                              '(DeviceBaseInfo inner join PlaceBaseInfo '+
                                'on DeviceBaseInfo.Device_PlaceID=PlaceBaseInfo.Place_ID) '+
                                'on DeviceBaseInfo.Device_TypeID=DeviceTypeInfo.DeviceType_ID) '+
                                'on DeviceBaseInfo.Device_ID=DEVICE_IpcameraAppendInfo.Device_ID)'+
                                'on DeviceBaseInfo.Device_ID=DEVICE_TvWallAppendInfo.Device_ID');     Try
        Query.Open;
        Memo.Lines.Add(Inttostr(Query.RecordCount));
        query.First;
        Query.Edit;
        Query.FieldByName('IPCAMERA_MULTIDESTIP').AsString:='Ok';
        Query.Post;
     Except
           exit;
     End;修改Device_name 可以,修改别的表就不行,提示:Insufficient key column information for updating or refreshing
少主键吗?
大家帮忙啊

解决方案 »

  1.   

    联合查询以后的数据集直接EDIT,数据集怎么知道你的那个字段应该更新到那个表里呢,看看李维的DELPHI5.0多层分布开发那本书好了。里面就讲了怎么对联合查询的字段进行修改
      

  2.   

    To yuanscar(塑料树) 谢谢啊,不过没时间去找啊,你简单的说说怎么改吧,谢谢啊,提示一下也行啊
      

  3.   

    现在比较忙,没时间具体说,他是用几个updatesql组件对应join的表,把数据集拆分开然后更新