delphi 数据库 我要把StringGrid中的数据添加到access数据库,请问下,怎么判断,如果数据存在就更新,如果数据不存在,就添加进去. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from 表名where 条件 adoquery1.close;adoquery1.sql.clean;adoquery1.sql.add('条件');adoquery1.open;if adoquery1.RecordCount >0update t set update_time = getdate() where id = 1elseinsert into t(id, update_time) values(1, getdate()) 数据库中还有别的数据呢,ADOQuery1.RecordCount > 0 ? 可以么。 那就where and and 多判断一下,我也是菜鸟,可能没太明白你的意思 为什么用StringGrid呢,不是有DBGrid吗?还有就是,每次你是插入一条数据,还是插入很多条数据? 用StringGrid只有循环1条条的对比数据,改用DBGrid吧,省掉很多事 就是用stringgrid读取出excel表中的N条数据,然后存到数据库,有时候数据库存在某些数据,所以要判断 里面没有的字段是不是唯一的?比如说ID。然后你根据所给的ID做为条件查询,> 0就存在,否则就不存在。上面已经说的很清楚了,就一句,如:select * from Table where ID = '+Edit1.Text+' (300分)embeddedWB,如何强制在同一窗口打开新页面 关于TCHART与时间的问题; 为什么我的delphi6不能调试 怎么样在程序或的焦点的情况下判断程序没有被操作的时间? v300() 请进,在线等 delphi 数据保存问题 急,装完Delph5后BDE组件页没有了,是怎么回事! 接业务 请问如何在程序里把word文档、网页文件等格式转换为纯文本格式? 今天送分了!请进 日期想减得秒数(要示例) Delphi编译出的程序,为什么在有的windows2003不能运行,内详,高手进
where 条件
adoquery1.sql.clean;
adoquery1.sql.add('条件');
adoquery1.open;
if adoquery1.RecordCount >0
update t set update_time = getdate() where id = 1
else
insert into t(id, update_time) values(1, getdate())
那就where and and 多判断一下,我也是菜鸟,可能没太明白你的意思
为什么用StringGrid呢,不是有DBGrid吗?还有就是,每次你是插入一条数据,还是插入很多条数据?