Autor Beitrag
flankengott
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: Mo 26.05.08 10:16 
Hallo!

Ich möchte via eines Buttons einen Ordner anlegen.
Grundsätzlich funktioniert dies auch ganze gut wenn ich einen fixen Ordername verwende. Doch mein Programm arbeitet mit einer Datenbank und so soll für jeden Namen ein Ordner angelegt werden wenn noch keiner vorhanden ist.

Sprich: ich definiere mir einen string "name" der sie mit fieldbyname vorname und nachname aus der db rausholt.

wie kann ich jetzt delphi klarmachen, dass ich eben den string "name" als deitname verwenden will?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
name:=adodataset2.fieldbyname('Familienname').asstring+' '+adodataset2.fieldbyname('Vornmae').asstring;

  if not DirectoryExists('C:\getdirname(name)') then
    if not CreateDir('C:\getdirname(name)') then
    raise Exception.Create('Verzeichnis c:\');


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Mo 26.05.2008 um 11:17
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 26.05.08 10:19 
Moin!

user profile iconflankengott hat folgendes geschrieben:
Ich möchte via eines Buttons einen Ordner anlegen.
Probier das mal so: ;)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
name := adodataset2.fieldbyname('Familienname').asstring+' '+adodataset2.fieldbyname('Vornmae').asstring;
if not DirectoryExists('C:\'+name) then
  if not CreateDir('C:\'+name) then
    raise Exception.Create('Verzeichnis c:\'+name+' konnte nicht erstellt werden!');
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
flankengott Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: Mo 26.05.08 10:28 
Danke - es hat funktioniert.... eigentlich wärs e ziemlich leicht gegangen! ;)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 26.05.08 10:51 
Moin!

Markierst du den Thread noch entsprechend, wenn dein Problem gelöst ist? Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.