procedure InsertFieldInfo(combobox : TComboBox ; fieldname : String ; table : TADOTable);begin
  table.First;  while table.Eof = false do
  begin
    combobox.Items.Add( table.fieldbyname( fieldname ).AsString );
    table.Next;
  end;  end;procedure TDiaoPaiForm.FormCreate(Sender: TObject);
var
    fieldname : String;
    table : TADOTable;
begin
    table := TADOTable.Create(application);
    ClothDataModule.m_Table.Close;
    ClothDataModule.m_Table.TableName := '年份编号';
    ClothDataModule.m_Table.Open;
    table := ClothDataModule.m_Table;
    fieldname := '年份编号';
    InsertFieldInfo(m_cbNianFenBianHao ; fieldname ; table);end;
显示的错误信息是:
[Error] DiaoPaiFrm.pas(97): Not enough actual parameters
[Error] DiaoPaiFrm.pas(97): Statement expected, but expression of type 'String' found
[Error] DiaoPaiFrm.pas(61): Unsatisfied forward or external declaration: 'TDiaoPaiForm.InsertFieldInfo'

解决方案 »

  1.   

    61:InsertFieldInfo(m_cbNianFenBianHao, fieldname, table);
      

  2.   

    不好意思,你们可能误解了,我知道错在InsertFieldInfo(m_cbNianFenBianHao, fieldname, table);
    但是不知道为什么,谢谢大家了
      

  3.   

    table.fieldbyname( fieldname ).AsString//不能加空格的
    table.fieldbyname(fieldname).AsString
      

  4.   


    不对
    是你的procedure InsertFieldInfo(combobox : TComboBox ; fieldname : String ; table : TADOTable);有问题
    加上这个咚咚
    procedure TDiaoPaiForm.InsertFieldInfo(combobox : TComboBox ; fieldname : String ; table : TADOTable);你忘了加上TDiaoPaiForm.了
    看看是不是这个原因
      

  5.   

    表什么属性都没有设置,设置一下TableName,ConnectionString,Active等。
      

  6.   

    InsertFieldInfo(m_cbNianFenBianHao ; fieldname ; table);
                                      ~~~         ~~~
    函數/過程 在調用的時候,參數用分號分隔嘛?
      

  7.   

    InsertFieldInfo(m_cbNianFenBianHao ; fieldname ; table);逗号
      

  8.   

    你看看 InsertFieldInfo 在定义和实现时参数的名字和个数是否一样
      

  9.   

    procedure InsertFieldInfo(combobox : TComboBox ; fieldname : String ; table : TADOTable);begin
      table.First;  while table.Eof = false do
      begin
        combobox.Items.Add( table.fieldbyname( '''+fieldname+''' ).AsString );
        table.Next;
      end;  end;试看看~
      

  10.   

    首先是你把一个表名当成另一个表的字段是个错误,看起来好象对,其实你动态生成的表里并没有字段“年份编号”,而显示table.fieldbyname( fieldname ).AsString 就更错了
    你想把另外一个表里的东西插入动态生成的表里,然后再在那个下拉框里显示,是不是啊
    试试下面的(已调试):
    procedure TForm1.FormCreate(Sender: TObject);
    var
        fieldname1,s : String;
        table : TADOTable;
    begin
        table := TADOTable.Create(application);
        adotable1.Close;
        adotable1.TableName := 'a';
        adotable1.Open;
        table := adotable1;
        fieldname1 := 'a';
        adotable1.First;
        while adotable1.Eof = false do
        begin
        s:=table.fieldbyname('userid').AsString;
        combobox1.Items.Add(s);
        adotable1.Next;
        end;
    end;
    表a的结构:
    create table a(userid char);
    insert into a values('1')
    insert into a values('2')根据这个你就知道问题出在哪里了,由这个启示把你的改正过来吧