SQL存储过程:
if exists(select * from sysobjects where name='Update_BJ' and type='P')
drop Procedure Update_BJ
go
print 'Creating Procedure Update_BJ ...'
go
Create Procedure Update_BJ @FDMC char(28),--编号
@FDBH tinyint, --名称
@UPDATE_RQ SMALLDATETIME OUT --输出日期
as
begin
if Exists (select * from SCBJ where FDID=@FDBH)
update SCBJ set SC_DATE=GETDATE() where FDID=@FDBH
else
insert SCBJ(FDID,FDMC) values(@FDBH,@FDMC)
select @UPDATE_RQ=SC_DATE from SCBJ where FDID=@FDBH
end
go表结构如下:
CREATE TABLE SCBJ(
FDID TINYINT PRIMARY KEY,
FDMC CHAR(24) NOT NULL,
SC_DATE DATETIME)DELPHI代码如下
uses inifiles;
var
filename:string;
myinifile:tinifile;
begin
filename:=ExtractFilePath(Paramstr(0))+'lsfdxx.ini';
myinifile:=tinifile.create(filename);
with StoredProc1 do
begin
close;
Params[0].AsString:=myinifile.ReadString('FDMC','CGFDMC','');
Params[1].AsInteger:=myinifile.Readinteger('FDBH','CGFDBH',0);
Prepare;
try
ExecProc;
except
abort;
end;
end;
end;为什么老是提示没有找到参数,我的连接都是动态的!那位能帮我调试一下,在下万分谢谢!--------------------------数据库引擎方式为BDE
if exists(select * from sysobjects where name='Update_BJ' and type='P')
drop Procedure Update_BJ
go
print 'Creating Procedure Update_BJ ...'
go
Create Procedure Update_BJ @FDMC char(28),--编号
@FDBH tinyint, --名称
@UPDATE_RQ SMALLDATETIME OUT --输出日期
as
begin
if Exists (select * from SCBJ where FDID=@FDBH)
update SCBJ set SC_DATE=GETDATE() where FDID=@FDBH
else
insert SCBJ(FDID,FDMC) values(@FDBH,@FDMC)
select @UPDATE_RQ=SC_DATE from SCBJ where FDID=@FDBH
end
go表结构如下:
CREATE TABLE SCBJ(
FDID TINYINT PRIMARY KEY,
FDMC CHAR(24) NOT NULL,
SC_DATE DATETIME)DELPHI代码如下
uses inifiles;
var
filename:string;
myinifile:tinifile;
begin
filename:=ExtractFilePath(Paramstr(0))+'lsfdxx.ini';
myinifile:=tinifile.create(filename);
with StoredProc1 do
begin
close;
Params[0].AsString:=myinifile.ReadString('FDMC','CGFDMC','');
Params[1].AsInteger:=myinifile.Readinteger('FDBH','CGFDBH',0);
Prepare;
try
ExecProc;
except
abort;
end;
end;
end;为什么老是提示没有找到参数,我的连接都是动态的!那位能帮我调试一下,在下万分谢谢!--------------------------数据库引擎方式为BDE
begin
Close;
StoredProcName:='Update_BJ';
Params.Clear;
Params.CreateParam('@FDMC', ftString, pdInput, 0, myinifile.ReadString('FDMC','CGFDMC',''));
Params.CreateParam('@FDBH', ftInteger, pdInput, 0, myinifile.Readinteger('FDBH','CGFDBH',0));
Params.CreateParam('@UPDATE_RQ', ftDateTime, pdOutput, 0, nil);
prepare;
try
ExecProc;
except
abort;
end;
end;
with StoredProc1 do
begin
Close;
DataBasename:='..';
StoredProcName:='Update_BJ';
Params.Clear;
Params.CreateParam(ftString,'@FDMC',ptinput);
Params.CreateParam(ftInteger,'@FDBH',ptinput);
Params.CreateParam(ftDateTime,'@UPDATE_RQ',ptoutput);
params[0].Size:=28;
params[0].Value :=myinifile.ReadString('FDMC','CGFDMC','');
params[1].Size:=8;
params[1].Value:=myinifile.Readinteger('FDBH','CGFDBH',0);
params[2].size:=18;
Prepare;
try
...