Autor Beitrag
Apo95
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129

Win2000, WinXP, WinServer 2003 Standard x86, Win7x64
Delphi 6 Enterprise, D2009 Architect, RAD Studio XE6 Architect
BeitragVerfasst: Sa 21.07.12 21:37 
Hallo,

ich versuche, eine EXCEL-Tabelle als Datenbankschnittstelle einzuschleusen. Leider klappt dies nicht so ganz; ich weiß nicht, was ich in die SELECT-Klausel der ADOQuery schreiben soll...

weiß jemand Rat?

Besten Dank im Voraus,

Apo95

_________________
Lette-Verein MIA
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Sa 21.07.12 23:46 
Anhand eines Beispiels die beteiligten Bausteine .... keine Produktivcode

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  AdoConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\mappe1.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";';
  AdoDataset1.Connection := AdoConnection1;
  AdoConnection1.GetTableNames(Memo1.Lines); 
  Adodataset1.CommandText := 'Select * from [' + Memo1.Lines[0] +']';
  Adodataset1.Open;

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Apo95 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129

Win2000, WinXP, WinServer 2003 Standard x86, Win7x64
Delphi 6 Enterprise, D2009 Architect, RAD Studio XE6 Architect
BeitragVerfasst: Mo 23.07.12 16:31 
Geht nicht, da die Ergebnisse in einer DBGrid angezeigt werden sollen. Ich hatte das vorher so versucht zu lösen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
adoquery1.Active := true;
  adoquery1.ExecSQL;
  if adoquery1.RecordCount = 1
  then begin
     Edit1.text := adoquery1ICD10-Registerschlüssel.Text;

  end
  else
  Edit1.Clear;
    MessageDlg('Es konnte kein Ergebnis gefunden werden.',mtError, mbOKCancel, 0);


Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt

_________________
Lette-Verein MIA
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 23.07.12 17:03 
Ich fürchte ich verstehe nur Bahnhof, der Codeschnipsel von mir stellt die Daten in einem DBGrid dar.
Hast Du Daten in der Tabelle, Header in den Spalten , wenn nicht muss der ConnectionString angepasst werden.

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS