Unable to make a SQL-request with dbExpress driver
Posted: Tue 31 Mar 2009 22:45
Hi all,
I'm new to dbExpress driver for PostgreSQL but have used dbExpress for years with FireBird.
In a test-app I have a TSQLConnection with a acompaning TSQLDataSet.
At startup I make a connection to my db with the following code:
SQLConnection1.Params.Values['HostName'] := 'localhost';
SQLConnection1.Params.Values['Database'] := 'minilc';
SQLConnection1.Params.Values['User_Name'] := 'postgres'; SQLConnection1.Params.Values['Password'] := 'mypwd';
SQLConnection1.Connected := true;
and connection succeedes.
Clicking a button in my test-app I reach the following code:
procedure TfrmMiniDb.btnOpenClick(Sender: TObject);
begin
if SQLDataSet1.Active then
SQLDataSet1.Close;
SQLDataSet1.CommandText :=
'Select * from CustomerInfo ' +
'where ' +
'name like ' + Chr(39) + '%Kalle%' + Chr(39);
SQLDataSet1.Open;
end;
At "SQLDataSet1.Open" I get the following error:
Operation not allowed on a unidirectional dataset
Copying the sql-request into pgAdmin III it works allright and
I think I should be allowed to do this.
Can anyone help me out please?
Regard
stab
I'm new to dbExpress driver for PostgreSQL but have used dbExpress for years with FireBird.
In a test-app I have a TSQLConnection with a acompaning TSQLDataSet.
At startup I make a connection to my db with the following code:
SQLConnection1.Params.Values['HostName'] := 'localhost';
SQLConnection1.Params.Values['Database'] := 'minilc';
SQLConnection1.Params.Values['User_Name'] := 'postgres'; SQLConnection1.Params.Values['Password'] := 'mypwd';
SQLConnection1.Connected := true;
and connection succeedes.
Clicking a button in my test-app I reach the following code:
procedure TfrmMiniDb.btnOpenClick(Sender: TObject);
begin
if SQLDataSet1.Active then
SQLDataSet1.Close;
SQLDataSet1.CommandText :=
'Select * from CustomerInfo ' +
'where ' +
'name like ' + Chr(39) + '%Kalle%' + Chr(39);
SQLDataSet1.Open;
end;
At "SQLDataSet1.Open" I get the following error:
Operation not allowed on a unidirectional dataset
Copying the sql-request into pgAdmin III it works allright and
I think I should be allowed to do this.
Can anyone help me out please?
Regard
stab