Delphi-Quellcode:
procedure TForm2.Button1Click(Sender: TObject);
var
ConnString :
String;
Connection : TADOConnection;
DataSet : TADODataSet;
SQL :
String;
Val : OleVariant;
Parameter :
String;
Value :
String;
Counter : Integer;
begin
try
Connection := TADOConnection.Create(Self);
DataSet := TADODataSet.Create(Self);
try
ConnString := '
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=..............;Data Source=............;
Connection.ConnectionString := ConnString;
try
Connection.Open;
SQL := 'Select * from parameter_changes_Monitoring_Parameter_Values order by Parameter'
;
connection.Execute(SQL);
DataSet.Connection := Connection;
DataSet.CommandType := cmdText;
DataSet.CommandText := SQL;
DataSet.Open;
try
begin
while (DataSet.Recordset.EOF = False ) do
begin
Counter:= Dataset.Recordcount;
Val := DataSet.RecordSet.Fields['Parameter'
].Value;
DataSet.Next
end;
end
except
// on E : Exception do
// SetError(...................);
end;
except
// on E : Exception do
// SetError(Error_Open_Database, E.Message);
end;
finally
try
if DataSet.Active then
DataSet.Close;
if Connection.Connected then
Connection.Close;
FreeAndNil(DataSet);
FreeAndNil(Connection);
except
// on E : Exception do
// SetError(Error_Closing_Database, E.Message);
end;
end;
except
// on E : Exception do
// SetError(Error_Creating_ADO_Objects, E.Message);
end;
end;
end.
ob der auszug sinn ergibt .. ist erstmal dahin gestellt .. hier geht es erstmal nur um das problem, dass die variable counter nicht den wert von recordcount annimmt..
Delphi-Quellcode:
while (DataSet.Recordset.EOF = False ) do
begin
Counter:= Dataset.Recordcount;
Val := DataSet.RecordSet.Fields['Parameter'].Value;
DataSet.Next
end;