Autor Beitrag
Almidagu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Fr 16.05.08 12:56 
Guten Tag,

wie kann man die Feldbeschreibung bei der Erstellung einer MSAccess-Tabelle mittels Delphi eingeben?

Danke im Voraus.
Almidagu
Almidagu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Fr 16.05.08 18:34 
Titel: ADOX mit Delphi 7 ???
Guten Tag noch mal,

es ist eine Erweiterung zu meiner ersten Frage. Könnte jemand mir Tip oder Links über die Verwendung von ADOX in Delphi 7 geben?

Danke im Voraus.
Almidagu
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: Fr 16.05.08 21:51 
user profile iconAlmidagu hat folgendes geschrieben:
wie kann man die Feldbeschreibung bei der Erstellung einer MSAccess-Tabelle mittels Delphi eingeben?


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure TAccessDbCreator.CreateColumn(const _Catalog: TAdoxCatalog;
  const _Table: TAdoxTable; const _Column: IdzDbColumnDescription);
var
  ComColumn: TAdoxColumn;
begin
  ComColumn := CoColumn.Create;
  ComColumn.ParentCatalog := _Catalog;
  ComColumn.Name := Format('%s%s', [FPrefix, _Column.Name]);
  ComColumn.Type_ := DATA_TYPE_MAPPING[_Column.DataType];
  if _Column.DataType in [dtMemo, dtText] then
    ComColumn.DefinedSize := _Column.Size;
  ComColumn.Properties['Nullable'].Value := (_Column.AllowNull = naNull);
  ComColumn.Properties['Description'].Value := _Column.Comment;
  { TODO -otwm -cbug : This apparently doesn't work, at least not for text and integer fields. }
  if not VarIsNull(_Column.DefaultValue) then
    ComColumn.Properties['Default'].Value := _Column.DefaultValue;
  ComColumn.Properties['AutoIncrement'].Value := _Column.AutoInc;
  // this is a very odd property, I think it makes sense to allow it only if null is also allowed
  ComColumn.Properties['Jet OLEDB:Allow Zero Length'].Value := (_Column.AllowNull = naNull);

  _Table.Columns.Append(ComColumn, Unassigned, Unassigned);
end;


Was ich leider nie rausgefunden habe, ist, wie man die Tabellenkommentar setzen kann. :-(

twm
Almidagu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Fr 16.05.08 22:58 
dummzeuch, vielen Dank!

Ohne Tabellenkommentar kann man leben:-)

Es gibt noch zwei Fragen:
Welcher Delphi-Version entspricht der Code?
Wo kann ich über ADOX weiter lesen?

Noch mal vielen Dank.
Almidagu
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: Sa 17.05.08 11:04 
user profile iconAlmidagu hat folgendes geschrieben:
dummzeuch
Ohne Tabellenkommentar kann man leben:-)

Ja, aber es waere halt nett gewesen.

Zitat:

Es gibt noch zwei Fragen:
Welcher Delphi-Version entspricht der Code?
Wo kann ich über ADOX weiter lesen?


Der Code war urspruenglich fuer Delphi 5 geschrieben und kann AFAIR unveraendert mit Delphi 7, 2005, 2006 und 2007 compiliert werden. Es ist ein Teil einer Bibliothek mit der man u.a. Access Datenbanken aus einer Beschreibung im XML-Format erzeugen kann. Ich habe sie vor vielen Jahren mal geschrieben und vor kurzem wieder rausgekramt, weil Access (leider) mal wieder zum Thema wurde.

Die Infos zu ADOX hatte ich aus dem Netz, ich kann Dir aber leider keine konkreten Quellen mehr nennen, dazu ist das alles zu lange her.
Schonmal Google gefragt? "ADOX delphi" liefert einiges an Treffern, Englisch sollte man aber koennen.

twm
Almidagu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Mo 19.05.08 17:54 
Danke vielmals dummzeuch!

Vor meiner Frage habe ich Internet "gegoogelt" und zwar mit den gleichen Worten. Englisch ist kein Problem, weil ich Russisch spreche:-)

Leider ist in Internet fast immer nur allgemeine Beispiele zum Delphi 5 und nur zur Erstellung einer ACCESS-Datenbank. Ich brauchte eine schon existierende Datenbank nachrüsten. Und ehrlich gesagt habe ich ein Prototyp schon vor deiner Antwort gebastelt, aber Dein Code erlaubte mir meinen Code richtig zu verbessern!

Ich habe nicht alles im Code verstanden, z.B. "DATA_TYPE_MAPPING", aber es ist nicht so wichtig.

Viel Erfolg und alles Gute.
Almidagu
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: Mo 19.05.08 19:31 
user profile iconAlmidagu hat folgendes geschrieben:
Ich habe nicht alles im Code verstanden, z.B. "DATA_TYPE_MAPPING"


Das ist ein Array, welches meine internen Datentypen in die von Access unterstuetzten umsetzt, also fuer Dich nicht weiter wichtig.

twm