首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

pb界面修改数据库数据解决办法

2012-03-21 
pb界面修改数据库数据我在一个修改按钮控件上打这样的代码,可是修改不了,高手帮帮忙啊,急String username,

pb界面修改数据库数据
我在一个修改按钮控件上打这样的代码,可是修改不了,高手帮帮忙啊,急
String username,webname,age,income,height,birthplace,phone,password,sex,marry,other
if rb_1.checked=true then 
update informaion
set information.username=sle_1.text,information.age=sle_3.text,information.income=sle_7.text,information.height=sle_5.text,information.birthplace=sle_6.text,
information.phone=sle_2.text,information.password=sle_8.text,information.sex='男',information.marry=sle_12.text,information.other=sle_9.text
where information.webname=sle_4.text;
else  
update informaion
set information.username=sle_1.text,information.age=sle_3.text,information.income=sle_7.text,information.height=sle_5.text,information.birthplace=sle_6.text,
information.phone=sle_2.text,information.password=sle_8.text,information.sex='女',information.marry=sle_12.text,information.other=sle_9.text
where information.webname=sle_4.text;
if SQLCA.sqlcode <> 0 then  
  
  messagebox("错误","修改失败") 

  return
else
messagebox("成功","修改成功") 
  end if 
end if

[解决办法]
一、楼主为什么不用数据窗口而用文本框来处理呢?
二、楼主的错误应该是提示字段不存在的吧,嵌入式SQL使用变量的时候要加‘:’号
String username,webname,age,income,height,birthplace,phone,password,sex,marry,other 
if rb_1.checked=true then 
update informaion 
set information.username=:sle_1.text,information.age=:sle_3.text,information.income=:sle_7.text,information.height=:sle_5.text,information.birthplace=:sle_6.text, 
information.phone=:sle_2.text,information.password=:sle_8.text,information.sex='男',information.marry=:sle_12.text,information.other=:sle_9.text 
where information.webname=:sle_4.text; 
else
update informaion 
set information.username=:sle_1.text,information.age=:sle_3.text,information.income=:sle_7.text,information.height=:sle_5.text,information.birthplace=:sle_6.text, 
information.phone=:sle_2.text,information.password=:sle_8.text,information.sex='女',information.marry=:sle_12.text,information.other=:sle_9.text 
where information.webname=:sle_4.text; 
if SQLCA.sqlcode <> 0 then
  
messagebox("错误","修改失败") 

return 
else 
messagebox("成功","修改成功") 
end if 
end if

热点排行