• 临时代码


    var
      access, t: OleVariant;
      tmpQuery: TADOQuery;
      FTable: _Table;
      FCatalog: _Catalog;
      FIndex: _Index;
      I: Integer;
      pty: adox_tlb.Property_;
      pties: adox_tlb.Properties;
      vrs: _Recordset;
    begin
      DeleteFile('s:	emp.mdb');
    
      FCatalog := CoCatalog.Create;
      FCatalog.Create(GetAdoAccConStr('s:	emp.mdb'));
    
      FTable := CoTable.Create;
      FTable.ParentCatalog := FCatalog;
      FTable.Name := 'test';
    
      FTable.Columns.Append('ISBN', adVarWChar, 50);
      FTable.Columns.Append('Price', adInteger, 4);
      FTable.Columns.Append('date', adDate, 0);
    //  FCatalog.Tables['test'].Columns['ISBN'].Properties['']
      FTable.Columns['ISBN'].Properties['Jet OLEDB:Allow Zero Length'].Value := False;
    
      FIndex := CoIndex.Create;
      with FIndex do
      begin
        Name := 'ISBN';
        PrimaryKey := True;
        Unique := True;
        Columns.Append('ISBN', adVarWChar, 50);
      end;
    
      FTable.Indexes.Append(FIndex, EmptyParam);
      FCatalog.Tables.Append(FTable);
    
      pties := FTable.Columns['date'].Properties;
    
      for I := 0 to pties.Count - 1 do
      begin
        pty := pties.Item[I];
        Memo1.Lines.Add(  pty.Name + '-' + VarToStr(pty.Value));
      end;
      Exit;
      access := CreateOleObject('ADOX.Catalog');
      access.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=s:	emp.mdb');
    
      tmpQuery := TAdoQuery.Create(nil);
      try
        tmpQuery.ConnectionString :=
          'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=s:	emp.mdb;Persist Security Info=True';
        with tmpQuery do
        begin
          Close;
          Sql.Clear;
          Sql.Add('CREATE TABLE T_test ');
          Sql.Add('( ');
          Sql.Add('t_a1 varchar(10), ');
          Sql.Add('t_a2 varchar(20) ');
          Sql.Add(')');
          ExecSql;
        end;
          //其实这里有 值的  ,和下面一样
        //下面一句 必须
        access.activeconnection :=
          'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=s:	emp.mdb;Persist Security Info=True';
    
        access.Tables['T_Test'].Columns['t_a1'].Properties('Jet OLEDB:Allow Zero Length') := true;
        access := Null;
    
        MessageBox(HANDLE, '成功创建。', '提示', MB_OK or
          MB_ICONINFORMATION);
      finally
        tmpQuery.Free;
      end;
    end;
    procedure TFormLOrder.Button3Click(Sender: TObject);
    var access, tbl:OleVariant;
      tmpQuery:TADOQuery;
    begin
      DeleteFile('s:	emp.mdb');
      access := CreateOleObject('ADOX.Catalog');
      access.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=s:	emp.mdb');
      try
    
        tbl := createOleobject('ADOX.Table');
        tbl.Name := 'T_Test';
        tbl.Columns.Append('t_a1');
        tbl.Columns.Append('t_a2');
        access.Tables.append(tbl);
    
        access.Tables['T_Test'].Columns['t_a1'].Properties('Jet OLEDB:Allow Zero Length'):=true;
        access := Null;
    
        MessageBox(HANDLE,'成功创建。','提示',MB_OK or MB_ICONINFORMATION);
      finally
        tmpQuery.Free;
      end;
    end;
  • 相关阅读:
    JqGrid在IE8中表头不能分组的解决办法
    Task 异步小技巧
    封装好的socket,拿去用
    反射 实现不同模型相同属性赋值 第二集(automapper)
    .net破解二(修改dll)
    .net破解一(反编译,反混淆-剥壳)
    c/s 自动升级(WebService)
    反射实现不同模型相同属性赋值
    row_number() over()分页查询
    SQL函数
  • 原文地址:https://www.cnblogs.com/CodeGear/p/4283593.html
Copyright © 2020-2023  润新知