您的位置:程序门 -> delphi ->



向大家请教一个delphi问题  希望能够帮忙啊。。。


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


向大家请教一个delphi问题 希望能够帮忙啊。。。
发表于:2007-10-24 08:57:46 楼主
我现在要编译的是一个保存按钮的代码,编译的时候都成功了,但是当录入信息之后点击保存的时候出现了如下错误信息“project   project1.exe   raised   exception   class   edatabaseerror   with   message'adoquerylrcxcx:,missing   sql   property'.   ”
希望大家能够帮我分析下啊,代码如下:
procedure   tjcxxlr.bitbtn4click(sender:   tobject);
var
    aq:tadoquery;
begin
    aq:=tadoquery.create(self);
    if   edit2.text=''   then
      begin
        messagebox(handle,pchar('系列代码不能为空,请输入!'),'提示',mb_ok);
        exit;
      end;
    if   edit3.text=''   then
    begin
    messagebox(handle,pchar('系列名称不能为空,请输入!'),'提示',mb_ok);
    exit;
    end;

    with   aq   do
    begin

        connection:=datamodule1.adoconnection1;
        sql.clear;
        sql.add('select   cxdm,cxmc   from   cx   where   cxdm='''+trim(edit2.text)+'''');
        open;
    end;
    if   aq.recordcount <> 0   then
        begin
            messagebox(handle,pchar('车系代号重名或代码有重复,不能保存'),'提示',mb_ok);
              exit;
        end;
    aq.close;
    aq.free;
    if   adoquerylrcxcx.active=false   then     adoquerylrcxcx.open;
  with   adoquerylrcxcx   do
    begin
      append;
        fieldbyname('cxdm').asstring:=edit2.text;
        fieldbyname('cxmc').asstring:=edit3.text;

      post;
    end;
    adoquerylrcxcx.sql.clear;
    adoquerylrcxcx.sql.add('select   *   from   cx   where   cxdm='''+trim(edit2.text)+'''');
    adoquerylrcxcx.open;
end;

end.
发表于:2007-10-24 09:07:091楼 得分:0
//这里open之前adoquerylrcxcx的sql有内容吗?
if   adoquerylrcxcx.active=false   then     adoquerylrcxcx.open;  
  with   adoquerylrcxcx   do  
    begin  
      append;  
发表于:2007-10-24 09:20:562楼 得分:0
没有内容啊,是因为这个吗   该怎么办啊?
发表于:2007-10-24 10:41:123楼 得分:0
sql没有内容,open的时候肯定不行啦!


aq.free;  
adoquerylrcxcx.sql.clear;
adoquerylrcxcx.sql.add('select   *   from   cx   where   1=2');
    if   adoquerylrcxcx.active=false   then     adoquerylrcxcx.open;  


快速检索

最新资讯
热门点击