with ADODataSet1 do
begin
Close ;
CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
AdoDataSet1.paramters.parambyname('str').value:=str;
AdoDataSet1.paramters.parambyname('p').value:=p;
AdoDataSet1.paramters.parambyname('q').value:=q;
open;
Active:=true;
end;
begin
Close ;
CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
AdoDataSet1.paramters.parambyname('str').value:=str;
AdoDataSet1.paramters.parambyname('p').value:=p;
AdoDataSet1.paramters.parambyname('q').value:=q;
open;
Active:=true;
end;
解决方案 »
- DBCtrlGrid的中图片显示的问题(点击面板触发了哪个事件)
- 如何通过DELPHI编程实现在MSSQL建立一个用户及密码
- 我想把汇编的代码用delphi写入
- firetoucher,我又有问题了。嘿嘿
- 几个问题!!!
- database控件的问题?????
- 如何判断sql数据库中一个字段的值是否为空?
- 菜鸟求助:请高手讲解一下delphi/run下第三项(param???)的具体用法
- 调查:大家都是做什么项目的?
- w102272(Wonder) 怎么和你联系?有人知道
- 怎么搜索 IE 浏览过的文件?
- 71分求助,如何使主窗体接收文本的拖放(如ie),然后把拖放的内容存储到form2的memo里?
现在是“参数P没有默认值”to Drate(小虫)
AdoDataSet1.paramters.parambyname('str').value:=str;
AdoDataSet1.paramters.parambyname('p').value:=p;
AdoDataSet1.paramters.parambyname('q').value:=q;
这三条语句编译出错:
Undeclared identifier:'paramters'
Missing operator or semicolon
请问两位,这个问题的原因是什么?
var p,q:integer;
str:string;
begin
str:=Edit1.Text;
p:=StrToInt(Edit2.Text);
q:=StrToInt(Edit3.Text);
with ADODataSet1 do
begin
Close ;
CommandText:=format('insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(''%s'',%d,%d)',[str,p,q]);
open;
Active:=true;
end;
end;
Project XX.exe raised exception class EOleException with messge ‘当前提供程序不支持从单一执行返回多个记录集’
这样写,出错信息为:“参数P没有默认值”
这是不是就意味着str的问题已解决?如果是的话,那整型变量值的插入应该如何表达?
str:string;
begin
str:=Edit1.Text;
p:=StrToInt(Edit2.Text);
q:=StrToInt(Edit3.Text);
with ADODataSet1 do
begin
Close ;
CommandText:=
'insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values('''+str+''''+','''+trim(p)+''''+','''+trim(q)+''''+')';
excute;
Active:=true;
end;
end;
那应该怎么做,用ADOCommand行不行?
begin
Close ;
CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
AdoDataSet1.paramters.parambyname('str').value:=str;
AdoDataSet1.paramters.parambyname('p').value:=p;
AdoDataSet1.paramters.parambyname('q').value:=q;
EXECSQL;
Active:=true;
end;
AdoDataSet1.paramters.parambyname('str').value:=str;
AdoDataSet1.paramters.parambyname('p').value:=p;
AdoDataSet1.paramters.parambyname('q').value:=q;
这三条语句编译出错:
Undeclared identifier:'paramters'
Missing operator or semicolon
Undeclared identifier:'EXECSQL'
open是数据集有返回值的时候使用,Execute是不返回数据集时候使用
with ADOCommand1 do
begin
Close ;
CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
paramters.ParamValues['str']:=str;
paramters.ParamValues['p']:=p;
paramters.ParamValues['q']:=q;
Execsql;
end;
Missing operator or semicolon
Missing operator or semicolon
Undeclared identifier:'EXECSQL'
Execsql应该为Execute
with ADOQuery1 do begin
Close;
Sql.Clear;
Sql.Add('insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)');
Parameters.ParamByName('str').Value :=str;
Parameters.ParamByName('p').Value :=p;
Parameters.ParamByName('q').Value :=q;
ExecSQL;
end;多谢各位!