关于DATAWINDOW的数据可编辑的总是的更改方法!

leng_cn 2003-01-21 02:13:51
我真够笨的,一直不知道DATAWINDOW中的数据怎么样变成可编辑的,
虽然查到了贴子,但也不知道怎么改,后来经同事的点拨才可以了,
实际上早该知道的,办法就是先选中那个DATAWINDOW,然后选择
FORMAT->tab order会在列表框上出现红色的TAB ORDER的值为0,我
是初学者,一直不知道怎么改,其实只要用鼠标点击,然后直接按
数字键就可以修改了,可我当初笨的光不知道双击呀什么的,都不
知道直接按键,结果问题就解决了,希望以后有高手们在回答问题
的时候能多给些提示,帮助我们这些低手快速进步呀,特发此贴,
算是对我的进步的鼓励,谢谢大家!
...全文
26 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yyccjj0 2003-01-21
  • 打赏
  • 举报
回复
靠,倒...
killerdanny 2003-01-21
  • 打赏
  • 举报
回复
hehe!!给你来函数!!该UPDATE属性的!

global type f_makedwupdateable from function_object
end type

forward prototypes
global subroutine f_makedwupdateable (ref datawindow dw, string tblname, string keys)
end prototypes

global subroutine f_makedwupdateable (ref datawindow dw, string tblname, string keys);long cc,col,row,duprows[],intnull[],loopcount1,keyIndex,rr;
long ntmp,originRows;
string str,errmsg,keycols[],filter,coltype,colName;
///////////

cc = long(dw.describe("datawindow.column.count"));
for col=1 to cc
colname = dw.describe("#"+string(col)+".name");
coltype = dw.describe(colname+".coltype");
str = colname+".update=Yes"
errmsg=dw.modify(str);
if errmsg<>'' then
// messagebox(str,errmsg);
end if
str = colname+".edit.NilIsNull=No"
errmsg=dw.modify(str);
if errmsg<>'' then
// messagebox(str,errmsg);
end if
next
////////
cc = pos(keys,',');
do while cc>0
str = left(keys,cc -1)
keys = mid(keys,cc+1);
keycols[upperbound(keycols)+1]=str;
errmsg=dw.modify(str+".key=Yes");
if errmsg<>'' then
messagebox("set key error",str+".key=Yes ~n"+errmsg);
end if
cc = pos(keys,',');
loop
errmsg = dw.modify(keys+".key=Yes");
keycols[upperbound(keycols)+1]=keys;
if errmsg<>'' then
messagebox("set key error",errmsg);
end if
//messagebox('keycols',keycols[1]);
///////
dw.modify("datawindow.table.updatetable='"+tblname+"'");
dw.modify("datawindow.table.updatewhere=0");
//messagebox('syntax',trim(string(dw.object.datawindow.syntax)));
/////// check duplicate rows by keys
////messagebox('rows',dw.rowcount());
originRows = dw.rowcount()
for loopcount1 = 1 to originRows
filter = '';
row = loopcount1;
if row> dw.rowcount() then exit;
for keyIndex = 1 to upperbound(keycols)
if filter <>'' then filter += ' and ';
colName = keycols[keyIndex];
coltype = dw.Describe(colName+'.ColType');
Coltype = Lower(Left(coltype,5));
choose case colType
case 'char('
str = dw.GetItemString(row,colName);
filter += keycols[keyIndex] +"='"+str+"'";
case 'numbe','decim','int','long'
str = string(dw.GetItemNumber(row,colName));
filter += keycols[keyIndex] +"="+str+"";
case 'date'
str = string(dw.GetItemDate(row,colName),'yyyy/mm/dd');
filter += keycols[keyIndex] +"=date('"+str+"')";
case 'datet'
str = string(dw.GetItemDatetime(row,colName),'yyyy/mm/dd hh:mm:ss');
filter += keycols[keyIndex] +"=datetime('"+str+"')";
case else
messagebox(colname+'.coltype',coltype+" 非法列");
end choose
next
// messagebox('filter',filter);
duprows = intnull;
rr = dw.find(filter,row + 1,dw.rowcount());
do while rr>0 and rr>row
duprows[upperbound(duprows)+1] = rr;
rr ++;
if rr>dw.rowcount() then exit;
rr = dw.find(filter,rr ,dw.rowcount());
loop
if upperbound(duprows)>0 then
// messagebox('dupfound for '+string(row),string(duprows[upperbound(duprows)]));
end if
for ntmp = upperbound(duprows) to 1 step -1
if dw.rowsdiscard(duprows[ntmp],duprows[ntmp],primary!)<>1 then
beeP(1)
messagebox('error discard','');
end if
next
next
//messagebox('rows',dw.rowcount());
/////
//// 初始化空字段 num->0 char->'';
double nV
string sV
any value
for row = 1 to dw.rowcount()
cc = long(dw.describe("datawindow.column.count"));
for col=1 to cc
colname = dw.describe("#"+string(col)+".name");
coltype = dw.describe(colname+".coltype");
Coltype = Lower(Left(coltype,5));
choose case colType
case 'char('
value = dw.GetItemString(row,colName);
if isnull(value) then
value = '';
else
continue
end if
case 'numbe','decim','int','long'
value = dw.GetItemNumber(row,colName);
if isnull(value) then
value=0;
else
continue
end if
case 'date','datet'
continue;
case else
continue;
end choose
dw.setitem(row,colname,value);
next
next

return ;

end subroutine

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧