![]() |
Re: Sql - Ado - Values
Ähm, den SQL (genauer: DDL)-Text würde ich einmalig mit einem Administrationstool auf die DB loslassen.
|
Re: Sql - Ado - Values
ich habe wieder eine frage und zwar ich möchte gern ein DateTimePicker via adoquery in n access db speichern und so sieht das ganze aus:
Delphi-Quellcode:
Ich bekomme eine Fehlermedldung: Ein Parameterobjekt ist nicht ordnunggemäß definiert.
procedure TForm2.Button3Click(Sender: TObject);
var dt: TDateTime; const STMT = 'Insert Into Tab_Fb_Ziel(' + 'paul, simon, alex, jean, rene, alain, simon, dominique, Raymond, Sylax, ' + 'jeanne, Yvonne, Claire, Nina, Pierre, Janson, Louis, Lila, maurice, Jahr ' + ') Values (' + ':paul, :simon, :alex, :jean, :rene, :alain, :simon, :dominique, :Raymond, :Sylax, ' + ':jeanne, :Yvonne, :Claire, :Nina, :Pierre, :Janson, :Louis, :Lila, :maurice, :jahr ' + ')' ; begin with adoquery1 do begin SQL.Text := STMT; dt:= Datetimepicker1.Date; Parameters.ParamByName('paul').Value := Edit1.Text; Parameters.ParamByName('Jahr').Value := dt; // ... ExecSQL; end; end; Dieser Fehler tritt auf seitdem ich das Objekt DateTimePicker1 eingefügt habe. Sieht jemand das Problem? mfg Poter |
Re: Sql - Ado - Values
Wie ist Jahr denn in der DB definiert?
|
Re: Sql - Ado - Values
Jahr ist folgende definiert:
Delphi-Quellcode:
Format: Datum, Kurz zb(09.11.2007)
|
Re: Sql - Ado - Values
Dann würde ich es mal so versuchen:
Delphi-Quellcode:
procedure TForm2.Button3Click(Sender: TObject);
var dt: TDateTime; const STMT = 'Insert Into Tab_Fb_Ziel(' + 'paul, simon, alex, jean, rene, alain, simon, dominique, Raymond, Sylax, ' + 'jeanne, Yvonne, Claire, Nina, Pierre, Janson, Louis, Lila, maurice, Jahr ' + ') Values (' + ':paul, :simon, :alex, :jean, :rene, :alain, :simon, :dominique, :Raymond, :Sylax, ' + ':jeanne, :Yvonne, :Claire, :Nina, :Pierre, :Janson, :Louis, :Lila, :maurice, :jahr ' + ')' ; begin with adoquery1 do begin SQL.Text := STMT; dt:= Datetimepicker1.Date; Parameters.ParamByName('paul').Value := Edit1.Text; Parameters.ParamByName('Jahr').AsDateTime := trunc(dt); // ... ExecSQL; end; end; |
Re: Sql - Ado - Values
Das ist es ja
Delphi-Quellcode:
Ich habe keine möglichkeit, nach
Parameters.ParamByName('Jahr').Value:= dt;
Delphi-Quellcode:
anzugeben. Ich kann alles mögliche wählen aber kein .AsDateTime.
Parameters.ParamByName('Jahr').AsDateTime
|
Re: Sql - Ado - Values
Sorry, mit ADO hab ich keine Erfahrungen. Aber ein Blick in die Hilfe sagt mir, dass das Setzen des Datentyps helfen könnte:
Delphi-Quellcode:
procedure TForm2.Button3Click(Sender: TObject);
var dt: TDateTime; const STMT = 'Insert Into Tab_Fb_Ziel(' + 'paul, simon, alex, jean, rene, alain, simon, dominique, Raymond, Sylax, ' + 'jeanne, Yvonne, Claire, Nina, Pierre, Janson, Louis, Lila, maurice, Jahr ' + ') Values (' + ':paul, :simon, :alex, :jean, :rene, :alain, :simon, :dominique, :Raymond, :Sylax, ' + ':jeanne, :Yvonne, :Claire, :Nina, :Pierre, :Janson, :Louis, :Lila, :maurice, :jahr ' + ')' ; begin with adoquery1 do begin SQL.Text := STMT; dt:= Datetimepicker1.Date; Parameters.ParamByName('paul').Value := Edit1.Text; Parameters.ParamByName('Jahr').DataType := ftDate; Parameters.ParamByName('Jahr').Value := trunc(dt); // ... ExecSQL; end; end; |
Re: Sql - Ado - Values
Klappt leider nicht
|
Re: Sql - Ado - Values
Dieselbe Fehlermeldung?
|
Re: Sql - Ado - Values
sag mal, wie ist deine tabelle eigentlich aufgebaut (welche datentypen haben deine einzelnen felder)... meine kristiallkugel hab ich leider in der firma vergessen...
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:15 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz