高手请看这段代码有什么问题,一运行就出现“DataWindow does not have capabilitity!
int i
long row,p,ll_rowcout,ll_counter
integer li_rec
string str
string c,name,val,ar,exp
dw_cx_set.accepttext()
row = dw_cx_set.rowcount()
if row>0 then
for i = 1 to row
name = dw_cx_set.object.col_name[i]
exp = dw_cx_set.object.exp[i]
val = dw_cx_set.object.val[i]
if isnull(name) or len(name)<1 or isnull(exp) or len(exp)<1 &
or isnull(val) or len(val)<1 then
dw_cx_set.deleterow(i)
i = i - 1
row = row -1
end if
end for
end if
row = dw_cx_set.rowcount()
if row>0 then
dw_cx_set.object.ar[row]=''
for i = 1 to row
name = dw_cx_set.object.col_name[i]
exp = dw_cx_set.object.exp[i]
val = dw_cx_set.object.val[i]
ar = dw_cx_set.object.ar[i]
if upper(val)='NULL' then
if upper(exp)='IS' then
str = str +" isnull("+name+") " +ar
elseif upper(exp)='IS NOT' then
str = str + " not(isnull("+name +")) " + ar
end if
else
select col_type into :c
from comm_col
where col = :name ;
p = pos(c,'(') - 1
if p>0 then c=mid(c,1,p)
choose case UPPER(c)
case 'DECIMAL','LONG','INT','BOOLEAN','DOUBLE','REAL','UINT','ULONG'
str = str + " " + name +" "+ exp +" "+ val +" "+ ar
case 'CHAR','VARCHAR'
str = str + " " + name+" "+ exp+ " '" +val + "' " +ar
case 'DATETIME','DATE'
str = str + " date(" + name+") "+ exp+ " date('" +val+"') "+ar
end choose
end if
end for
c = dw_cx_set.object.ar[row]
if not(len(c)<1 or isnull(c)) then
str = mid(str,1,len(str)-3)
end if
end if
dw_parent.setfilter('')
dw_parent.filter()
dw_parent.setfilter(str)
dw_parent.filter()
//以下为我做的删除LL2403 4.4
if dw_parent.rowcount()=0 then
messagebox("提示信息!","没有查询到符合删除条件的数据,请重新选择.")
return // LL2403
str=''
dw_parent.setfilter(str)
dw_parent.filter()
closewithreturn(parent,str)
else
li_rec = MessageBox("警告!","删除这些数据将无法恢复!~r~n确认要删除这些数据",Exclamation!,YesNO!,2)
choose case li_rec
case 1
ll_RowCout = dw_parent.Rowcount()
for ll_counter = 1 to ll_RowCout
dw_parent.ScrollToRow(ll_counter)
if dw_parent.DeleteRow(0) = -1 then
messagebox("提示信息","发生错误!")
end if
next
if dw_parent.update() = 1 then //问题就在这儿
COMMIT USING SQLCA;
MessageBox("提示信息","数据已成功删除!")
else
MessageBox("提示信息","数据删除失败!")
ROLLBACK USING SQLCA;
end if
case 2
return 1
end choose
end if
closewithreturn(parent,str)
问题点数:0、回复次数:14Top
1 楼superbee111(蜜蜂)回复于 2004-04-04 19:50:28 得分 0
就在更新dw_parent.update()有问题,请帮忙看看!先谢谢了Top
2 楼superbee111(蜜蜂)回复于 2004-04-04 21:03:30 得分 0
错了,出错提示是:DataWindow does not have UPDATE capability!请问一下有遇见过这样问题并且解决了的吗,请告诉一下解决的方法,非常着急,明天就要交差了!!!Top
3 楼TGWall(Begin-End)回复于 2004-04-04 21:20:00 得分 0
在数据窗口中, 选择菜单Rows-->Update properties, 在弹出的窗口中指定Updateable Columns并指定Unique Key column(s)Top
4 楼superbee111(蜜蜂)回复于 2004-04-04 22:23:27 得分 0
能再具体一些吗,说说为什么会出现这种情况,谢谢你啦!:)Top
5 楼superbee111(蜜蜂)回复于 2004-04-04 22:45:20 得分 0
虽然我到现在还没解决掉这个问题,起码知道原因在哪儿了,谢谢你——(我到长城(岁岁花似人不同,过好今天))祝天天快了!:)Top
6 楼liuliu13654002686()回复于 2004-04-05 07:36:55 得分 0
在数据窗口中, 选择菜单Rows-->Update properties, 在弹出的窗口中指定Updateable Columns并指定Unique Key column(s)
完全正确Top
7 楼pansmonkey(风清扬)回复于 2004-04-05 16:04:59 得分 0
点击Rows-->Update properties,在弹出的窗口中指定Unique Key column(s)在Updateable Column中选上你要更新的列,左上角的Allow Updates选上,再选上你要更新的表名,在下面的选项中选择Key and Updateable columns和Use delete then insert或是其他的组合(视你的需求而定).这样就可以了.Top
8 楼runsoft(清风)回复于 2004-04-05 20:30:35 得分 0
楼主好学,不错Top
9 楼superbee111(蜜蜂)回复于 2004-04-05 21:06:15 得分 0
上面的问题解决了,可是那只能更新一个表,现在遇见三个表连接要更新其中的两个,请问有哪位高手知道怎么做吗,我用的是pb6。5,谢谢!!!Top
10 楼fanglittlesun(菜菜子)回复于 2004-04-05 21:30:35 得分 0
用两个数据窗口提交Top
11 楼xyzliuin(我变,我变,我变变变)回复于 2004-04-07 10:33:55 得分 0
用代码动态更新,论坛里有贴子,搜一下,我也发过Top
12 楼cjxwcl(陈)回复于 2004-04-07 10:41:16 得分 0
设计多表处理更新的数据窗口时,动态更改数据窗口表更新属性。基本框架代码如下:
1、修改数据窗口列更新属性:dw_1.modify("列名.update=yes")
2、修改数据窗口表主键名:dw_1.modify("表主键名.key=yes")
3、修改数据窗口可更新表:dw_1.modify("DataWindow.Table.UpdateTabe=表名")
Top
13 楼cjxwcl(陈)回复于 2004-04-07 10:43:37 得分 0
感觉比较麻烦的话,可以通过变量取数据窗口当前行内容值,通过动态SQL语句直接插入表。Top
14 楼xiao_bai(小白)回复于 2004-04-08 14:26:53 得分 0
楼主遇到的情况比较普遍,给出通常的两种解决方法:
第一种(本人推荐):首先参考楼上诸位高手给出的“在数据窗口中, 选择菜单Rows-->Update properties, 在弹出的窗口中指定Updateable Columns并指定Unique Key column(s)
”保证其中一个表可以更新,然后另外的表采用SQL语句提交执行
第二种:完全采用程序来动态改变执行更新的表,代码比较繁琐一些,应该有帖子说明如何做,自己找一下吧Top




