Aug
03
关于增加表的字段问题的提问,请帮忙,谢谢!
Posted by admin
procedure tfrmadd.button1click(sender: tobject);
var cangwei:string;
fieldcount:integer;
begin
self.qryadd.sql.add(alter table routefare add :cangwei real null);
self.qryadd.sql.parambyname(cangwei).asstring:=self.edit1.text;
self.qryadd.execsql;
fieldcount:=datamodule1.tblroutefare.fieldcount;
datamodule1.tblroutefare.fields[fieldcount].asstring:=trim(self.edit2.text);
end;
在我的程序中用了cangwei这个参数,sql语句在分析器中已经查过了,但是在执行到execsql时总是报语法错误。请问我怎样才能将数据库表中增加字段且命名为我在form上edit中所输入的字符串啊,谢谢了!
参考文章:
发表者:tj_dns
self.qryadd.sql.add(alter table routefare add +:cangwei+ real null);
.