急,数据窗口多表更新问题,请各位仁兄帮忙
Int li_ResultUpdate,j
string ls_id
ls_id = dw_1.GetItemString(1, "code_id")
//dw_1.setitem(1,"sbd_print_color_code_id",ls_id)
if ls_id='' or isnull(ls_id) then
messagebox("系统提示","编码不能为空!")
dw_1.setfocus()
else
select count(*) into :j from sbd_print_color where code_id =:ls_id using sqlca;
if j >=1 then
messagebox("系统提示","该数据已经计算完成,不能重复计算!")
dw_1.setfocus()
else
//首先更新sbd_print_spend表
li_ResultUpdate= dw_1.Update(True,false)
//更新sbd_print_spend表成功执行,设置sbd_print_spend表为不可更新
If li_ResultUpdate= 1 Then
dw_1.ModIfy("sbd_print_spend_code_id.Update = 'no'")
dw_1.ModIfy("sbd_print_spend_machine_id.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_ink_type.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_print_stuff.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_stuff_ply.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_stuff_type.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_theo_longth.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_start_longth.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_total_longth.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_stuff_weight.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_knife_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_print_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_thinner_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_dep_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_cots_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_elec_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_air_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_steam_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_total_spend.Update = 'No'")
dw_1.ModIfy("sbd_print_spend_code_id.Key = 'no'")
// 设置sbd_print_color表为可更新
dw_1.ModIfy("DataWindow.Table.UpdateTable = 'sbd_print_color'")
dw_1.ModIfy("sbd_print_color_code_id.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color1.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color.proportion1.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color2.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion2.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color3.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion3.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color4.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion4.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color5.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion5.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color6.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion6.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color7.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion7.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color8.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion8.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color9.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion9.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_color10.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_proportion10.Update = 'Yes'")
dw_1.ModIfy("sbd_print_color_code_id.Key = 'Yes'")
//更新sbd_print_color表
li_ResultUpdate = dw_1.Update()
if li_ResultUpdate=1 Then
MessageBox("系统提示", "保存成功!")
Commit Using SQLCA;
Else
MessageBox("系统提示", "保存失败!")
Rollback Using SQLCA;
End If
//恢复数据窗口开始时的属性,以便下一次用户点击“保存”按钮时程序能够正确执行
dw_1.ModIfy("sbd_print_spend_code_id.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_machine_id.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_ink_type.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_print_stuff.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_stuff_ply.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_stuff_type.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_theo_longth.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_start_longth.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_total_longth.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_stuff_weight.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_knife_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_print_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_thinner_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_dep_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_cots_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_elec_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_air_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_steam_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_total_spend.Update = 'yes'")
dw_1.ModIfy("sbd_print_spend_code_id.Key = 'yes'")
dw_1.ModIfy("DataWindow.Table.UpdateTable = 'sbd_print_spend' ")
dw_1.ModIfy("sbd_print_color_code_id.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color1.Update = 'no'")
dw_1.ModIfy("sbd_print_color.proportion1.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color2.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion2.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color3.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion3.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color4.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion4.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color5.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion5.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color6.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion6.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color7.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion7.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color8.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion8.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color9.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion9.Update = 'no'")
dw_1.ModIfy("sbd_print_color_color10.Update = 'no'")
dw_1.ModIfy("sbd_print_color_proportion10.Update = 'no'")
dw_1.ModIfy("sbd_print_color_code_id.Key = 'no'")
Else
MessageBox("系统提示","保存失败!")
Rollback Using SQLCA;
End If
end if
end if