先根据每行和每例定位到数据库中。如有则updat否者,insert
要用到stringgrid.cells[x,y],row,col等信息。
要用到stringgrid.cells[x,y],row,col等信息。
解决方案 »
- 长天落日,霜降例作
- 一个关于字符串“异或”的问题--------在线等待!!!!!
- delphi的报表预览时会自动新建一窗体,有没有办法指定是在哪一个窗体预览,并且上面有一些控制按钮,我可不可以自己做?
- 如何将一段文本,写代码导入到数据库中???
- 请介绍一下DirectX开发的书
- 我想用三层结构开发一个商业进销存软件,请介绍DELPHI三层结构的好书?
- 用什么控件可以将一段HTML代码解释后显示出来?
- Delphi可以做到吗?
- 为什麽delphi的数据SQL Explorer里有的数据库要用密码和用户名如何解决!
- delphi xe10 除了ie还可以用别的浏览器做内核吗?
- 存储过程是否支持数组参数传递?如能请给例子
- 请问那里有DirectX的函数声明?for DirectX的
你可以用Query啊,
是不是
if exists select * from 表1 where 表1.日期=日期 表1.卡号=卡号
then
update......
else
insert into .....
我以前没写过存储过程,请指教
你只要循环调用就可以了!
print 'create procedure ow_sav_working ...'if exists (select * from sysobjects where id = object_id('dbo.ow_sav_working') and sysstat & 0xf = 4)
drop procedure dbo.ow_sav_working
GOcreate procedure ow_sav_working
@Code varchar(16),--卡号
@Date char(8),
@Class char(1)--班次
as
begin
if (exists(select * from [表] where [Code]=@Code and [Date]=@Date))
Update [表] set [Class]=@Class where [Code]=@Code and [Date]=@Date
else
Insert [表] values(@Code,@Date,@Class)
if @@rowcount<>1 then
return = -1--失败
return 0
endGO