Hi
I decided to migration from ADO to SDAC.
I download Trial and Install it on Delphi 10.4.2.
I encountered the following problems and did not find a solution
I have used the following commands in my program code.
1- TMSSQL.SetLength(KFields, all);
2- String1 := TMSSQL.FieldByName('FName').AsString;
3- TMSSQL.FieldCount
4- TMSSQL.Reccount
5- TMSSQL.DesignerData
I searched the forum, but did not find what I was looking for.
Where can I find the answers to my problems?
Regards.
Migration From Ado To Sdac
Re: Migration From Ado To Sdac
TMSSQL does not return any records, so you cannot retrieve the data.
Use a TMSQuery component for this purpose, e.g.
Use a TMSQuery component for this purpose, e.g.
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
MSQuery1: TMSQuery;
i: Integer;
begin
MSQuery1 := TMSQuery.Create(nil);
MSQuery1.Connection := MSConnection1;
MSQuery1.SQL.Text := ' select * from table order by id ';
MSQuery1.Open;
Memo1.Lines.Add('Records count: ' + IntToStr(MSQuery1.RecordCount));
if not MSQuery1.IsEmpty then
begin
MSQuery1.First;
while not MSQuery1.EOF do
begin
Memo1.Lines.Add('Record no: ' + IntToStr(i));
for i := 0 to MSQuery1.FieldCount - 1 do
Memo1.Lines.Add(MSQuery1.Fields[i].FieldName + ': ' + MSQuery1.Fields[i].AsString); //or: MSQuery1.FieldByName(MSQuery1.Fields[i].FieldName).AsString
MSQuery1.Next;
end;
end;
MSQuery1.Close;
end;