如题:我的代码:
    adoxCatalog: _Catalog;
    adoxTable: _Table;
    adoxColumns: Columns;窗体创建时: adoxcatalog := cocatalog.Create;打开表时 :
  con1.GetTableNames(cbbTbl.Items, false);
  adoxcatalog.Set_ActiveConnection(con1.ConnectionObject);
  adoxtable := adoxcatalog.Tables[cbbTbl.ItemIndex + sysTblCount];
  //系统表不显示
  adoxcolumns := adoxtable.Columns;然后
  with adoxcolumns[colIndex] do
  begin
    for ipts := Properties.Count - 1 downto 0 do
      if properties.item[ipts].Name = 'Default' then
      begin
        sResult + Properties[ipts].Value; 
        break;
      end;
  end;
  ShowMessage(sResult);出现错误,提示---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EOleException with message '对象或提供者不能执行所需的操作。'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

解决方案 »

  1.   

    换个思路:
    procedure TDataModuleMain.SetDefault(DataSet: TADODataSet; PriField: string);
    Var i:Integer;
    begin
      For i:=0 to DataSet.Fields.Count-1 do
        begin
        if UpperCase(DataSet.Fields.Fields[i].FieldName)=UpperCase(PriField) then Continue;
        Case DataSet.Fields.Fields[i].DataType of
          ftString,ftFixedChar, ftWideString :
            DataSet.Fields.Fields[i].Value:='';
          ftLargeint,ftSmallint, ftInteger, ftWord, ftBoolean, ftFloat, ftCurrency, ftBCD :
            DataSet.Fields.Fields[i].Value:=0;
        end;
        end;
    end;
      

  2.   

    呵呵,不好意思,也许我没说清楚,我是说在sql里面已经设置好默认值了,我现在想用ADOX取出这个默认值,而不是设置默认值.谢谢.请继续