当前位置: 代码迷 >> PB >> 用datawindow逐条查询数据库解决办法
  详细解决方案

用datawindow逐条查询数据库解决办法

热度:130   发布时间:2016-04-29 09:51:34.0
用datawindow逐条查询数据库
我想的是用datawindow实现单条数据库查询,思想是先按条件查出所有符合条件数据,然后将数据存入一个空表,再用datawindow实现,代码如下
SQLCA.DBMS = "ODBC"

SQLCA.AutoCommit = False

SQLCA.DBParm = "ConnectString='driver=Microsoft Access Driver (*.mdb);DBQ=d:\java程序\information.mdb'"

CONNECT;
String webname,birthplace,age,income,height,sex,other

select information.webname,information.birthplace,information.age,information.income,information.height,information.sex,information.other
into :webname,:birthplace,:age,:income,:height,:sex,:other
from information
where information.webname=:sle_5.text;
insert into three(webname,birthplace,age,income,height,sex,other)
values(webname,birthplace,age,income,height,sex,other);

dw_1.SetTransObject(SQLCA)
dw_1.Retrieve()
高手请帮忙看看在哪出错的,急用!

------解决方案--------------------
一、你的代码编译应该是通不过的;
a.你组织字符串的时候都用的是单引号,你去对一下看看肯定是有问题的;
b.你的sle_10.text组织的时候不是放到字符串里面而是要把值组织起来
比如
ls_sql = " information.height<=:sle_10.text"应该为
ls_sql = " information.height<=" + sle_10.text
你的setsqlselect返回值应该是-1的,没成功~~
二、看你的代码有点晕了,为什么不直接用数据窗口查出来而要动态设置数据窗口的检索条件呢?
  相关解决方案