存储过程问题?(50分)

G

gmwing

Unregistered / Unconfirmed
GUEST, unregistred user!
我在SQL SERVER中定义了一个这样的过程:
CREATE PROCEDURE intorecodes
@dh char(10),
@cp char(10),
@sj char(8),
@qsr char(8),
@bz char(50),
@hcsj datetime
AS
insert into chcdjb values(@dh,@cp,@sj,@qsr,@bz,@hcsj)
GO
当我在FROM中赋给参数值:
procedure TForm2.BitBtn1Click(Sender: TObject);
var
sql1:string;
begin
sql1:='intorecodes '+label6.Caption+','+combobox1.text+','+combobox2.text
+','+combobox3.text+','+'wrertrete'+','+'2002-10-23';
with datamodule1.adoquery6 do
begin
close;
sql.clear;
sql.add(sql1);
execsql;
end;
end;

时总是出错:
Project project1.exe raised exception class EOleExcption with message '第1行:
'.'附近有语法错误。;.process stopped .use step or run to continue.
是什么原因造成的?请各位富翁指教!
 
[:D]5555.............
 
sql1:='EXEC intorecodes '''+label6.Caption+''','''+combobox1.text+''','''+
combobox2.text+''','''+combobox3.text+''','''wrertrete''','''2002-10-23''';
with datamodule1.adoquery6 do
begin
close;
sql.clear;
sql.add(sql1);
execsql;
end;
 
没有用过你这种方法,我一般赋值这样:
with proc1 do
begin
ParamByName('@dh').value:=label6.Caption;
...
Prepare;
ExecProc;
end;
 
多谢!!
 
顶部