[Lazarus] PostgreSQL database connection error

Joost van der Sluis joost at cnoc.nl
Thu May 29 23:33:02 CEST 2008


Op vrijdag 30-05-2008 om 04:43 uur [tijdzone +0800], schreef peng:

> According to PostgreSQL users told me that in the P client set
> transcoding, for example:SET CLIENT_ENCODING TO 'GBK' .
> The GBK is better able to show that the Chinese encoding, but, which
> position this SQL statement to add in ? I tried to add SQL attributes
> in TSQLQuery components,  such as: 
> 
> set client_encoding to 'gbk'
> Select * from xiang 


> However, Lazarus report errors: 
> ------------------------------ 
> error: 
>          Operation cannot be performed on an active dataset 
> OK 
> ------------------------------ 
> 
> If I make the database active attribute to false, then it can no longer be a True.

You should first set the client_encoding with
'TSQLConnection.ExecuteDirect('set client_encoding to ''gbk'');'
Then you can open your query. (Note that you can only change the
sql-statement of an query when it's closed)

Joost.





More information about the Lazarus mailing list