我在Sql Server 2000中寫了一個很簡單的storeprocedure 但是我在D5中用的老是報錯不知道是甚麼錯了,請各位,指出
StoredProcedure如下:表名cust ,其中有兩個字段skind,scustno
CREATE PROCEDURE bExistSameCustName
( @skind char(60),
@scustno char(60))
AS
select count(*) from tbscust
where skind=@skind and scustno=@scustno
我在D5中用一個storedproce的控件是這么寫的
spCust : TStoredProc ;
with spCust do
begin
databaseName := db1; //已保證正確
spCust.Close ;
spCust.StoredProcName := 'bExistSameCustName' ;
spcust.parambyname('@skind').asstring :='1' ;
spcust.parambyname('@scustno').asstring := LangToSave(CaoEdit1.Text);
spCust.PrePare ;
spCust.ExecProc ;
if spCust.Fields[0].asinteger<>0 then
begin...........end;
end 可是一run 會報沒有參數@skind,不舕甚麼
end;
StoredProcedure如下:表名cust ,其中有兩個字段skind,scustno
CREATE PROCEDURE bExistSameCustName
( @skind char(60),
@scustno char(60))
AS
select count(*) from tbscust
where skind=@skind and scustno=@scustno
我在D5中用一個storedproce的控件是這么寫的
spCust : TStoredProc ;
with spCust do
begin
databaseName := db1; //已保證正確
spCust.Close ;
spCust.StoredProcName := 'bExistSameCustName' ;
spcust.parambyname('@skind').asstring :='1' ;
spcust.parambyname('@scustno').asstring := LangToSave(CaoEdit1.Text);
spCust.PrePare ;
spCust.ExecProc ;
if spCust.Fields[0].asinteger<>0 then
begin...........end;
end 可是一run 會報沒有參數@skind,不舕甚麼
end;
spCust.Close ;
spCust.StoredProcName := 'bExistSameCustName' ;
spcust.params.Clear;
spcust.params.Add;
spcust.params.Add;
spcust.params[0].Name := '@skind';
spcust.params[1].Name := '@scustno';
spcust.params[0].Value :='1' ;
spcust.params[0].Value := LangToSave(CaoEdit1.Text);
spCust.PrePare ;
spCust.ExecProc ;
all "Params" must replace by "Parameters"
Parameters.ParamByName('@skind').Value := '1';
Parameters.ParamByName('@scustnod').Value := LangToSave(CaoEdit1.Text);