Code: Select all
const DEVART_MSSQL_CONNECTION_STRING = ''
+'%s=DevartSQLServer;%s=%s;%s=%s;%s=%s;%s=%s'
+';BlobSize=-1;SchemaOverride=%%.dbo;LongStrings=True;EnableBCD=True'
+';FetchAll=True;UseUnicode=True;IPVersion=IPv4';
procedure TForm1.Button1Click(Sender: TObject);
var
cn: TDBXConnection;
FConnectionProps: TDBXProperties;
FConnectionFactory: TDBXConnectionFactory;
cmd: TDBXCommand;
rer: TDBXReader;
begin
FConnectionProps := TDBXProperties.Create;
FConnectionProps.SetProperties(Format(DEVART_MSSQL_CONNECTION_STRING,
[TDBXPropertyNames.DriverName,
TDBXPropertyNames.HostName, 'localhost',
TDBXPropertyNames.Database, 'ADBDEMOS',
TDBXPropertyNames.UserName, 'sa',
TDBXPropertyNames.Password, 'saps']));
FConnectionFactory := TDBXConnectionFactory.GetConnectionFactory;
cn := FConnectionFactory.GetConnection(FConnectionProps);
cmd := cn.CreateCommand;
cmd.Text := 'SELECT * FROM employee where empno=:empno';
cmd.Prepare;
if cmd.Parameters.Count > 0 then
begin
if cmd.IsPrepared then
begin
rer := cmd.ExecuteQuery;
if rer.Next then
Caption := rer.Values[0].AsString;
rer.Free;
end;
end;
cmd.Free;
end;
However I get the False.
Should I how to do?