风
风子
Unregistered / Unconfirmed
GUEST, unregistred user!
我在尝试做一个在线考试系统,需要向后台(sqlserver7)题库录入题目。
我先在数据模块中建立TransactionDB(TADOconection)然后连上Addquery(TAdoquery)
代码是这样写的:
procedure TfrmAdd.bnOKClick(Sender:TObject);
begin
testmodule.TransactionDB.BeginTrans;
with testmodule.AddQuery do
begin
close;
sql.clear;
sql.add('insert into tiku(kmfl,tx,ndxs,fenzi,timu,answer)');
sql.add('valueskmfl,:tx,:ndxs,:fenzi,:timu,:anwser)');
parameters.parambyname('kmfl').value:=cmbKemu.itemindex+cmbZJ.itemindex*10;
parameters.parambyname('tx').value:=cmbtx.itemindex;
parameters.parambyname('ndxs').value:=cmbndxs.itemindex;
parameters.parambyname('fenzi').value:=seFZ.value;
parameters.parambyname('timu').value:=memoTimu.Text;
parameters.parambyname('anwser').value:=memoAnswer.text;
sql;
execsql;
close;
end;
testmodule.TransactionDB.CommitTrans;
我觉得代码没错,可运行到testmodule.TransactionDB.BeginTrans;时出错:
project project1.exe raised exception class EOleException with message 'the application
is using arguments that are of wrong type ,are out of acceptable range,or in confilct
with one another'.process stopped. use step or run to continue.
project1是我的工程文件
我先在数据模块中建立TransactionDB(TADOconection)然后连上Addquery(TAdoquery)
代码是这样写的:
procedure TfrmAdd.bnOKClick(Sender:TObject);
begin
testmodule.TransactionDB.BeginTrans;
with testmodule.AddQuery do
begin
close;
sql.clear;
sql.add('insert into tiku(kmfl,tx,ndxs,fenzi,timu,answer)');
sql.add('valueskmfl,:tx,:ndxs,:fenzi,:timu,:anwser)');
parameters.parambyname('kmfl').value:=cmbKemu.itemindex+cmbZJ.itemindex*10;
parameters.parambyname('tx').value:=cmbtx.itemindex;
parameters.parambyname('ndxs').value:=cmbndxs.itemindex;
parameters.parambyname('fenzi').value:=seFZ.value;
parameters.parambyname('timu').value:=memoTimu.Text;
parameters.parambyname('anwser').value:=memoAnswer.text;
sql;
execsql;
close;
end;
testmodule.TransactionDB.CommitTrans;
我觉得代码没错,可运行到testmodule.TransactionDB.BeginTrans;时出错:
project project1.exe raised exception class EOleException with message 'the application
is using arguments that are of wrong type ,are out of acceptable range,or in confilct
with one another'.process stopped. use step or run to continue.
project1是我的工程文件