我在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
少主键吗?
大家帮忙啊
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
少主键吗?
大家帮忙啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货