Answer the question
In order to leave comments, you need to log in
How to select data using UniDac from DBF?
The question is a little general, since this component has a huge number of settings.
I am writing a program using UniDac and DBF for the first time and I doubt the correctness of my code.
Working code. But there are some questions and problems.
base_path:='C\base\'; //Путь к базе
//sql_request:='SELECT * FROM BASE1 WHERE N="13116"'; //Запрос - находит данные
sql_request:='SELECT * FROM BASE1 WHERE F_NAME="Иван"'; //Запрос - не находит данные, а Иван в F_NAME есть.
UniConnection1.ProviderName := 'DBF';
UniConnection1.Database := base_path;
UniConnection1.SpecificOptions.Values['DBFFormat'] := 'dfFoxPro2';
UniConnection1.SpecificOptions.Values['Direct'] := 'True';
UniConnection1.Connect;
UniQuery1.Connection := UniConnection1;
UniQuery1.SQL.Text :=sql_request;
UniQuery1.Open;
sql_result:=UniQuery1.FieldByName('NAME').AsString; //Получили данные выполнив запрос
records_count:=UniQuery1.RecordCount; //Заодно и узнаем сколько там строк
memo1.Lines.Add(inttostr(records_count)); //Вывели
memo1.Lines.Add(sql_result); //Вывели
UniQuery1.Close;
UniConnection1.Close;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question