Unicode parametric query lazarus / 16-Databases ---------------------------------------------------------------------- djdjdjole · 2016-08-25 18:25 I don't know whether this question is for Lazarus or UniDAC forum. I have some Serbian Latin strings in my SQL Server. My query is simple one and is quoted in UniQuery SQL property at design time as: select * from mytable where name='Šeki'. I correctly receive the only record which satisfied condition. However when I change the query to: select * from mytable where name=:par0 and in code: query.parambyname(par0).asstring:= 'Šeki', I receive no record. Field "name" is "nvarchar" in database, collation Croatian, client OS- Windows10 (64- bit), database machine is Windows Server 2012 (64- bit) and Lazarus version is 1.6. ---------------------------------------------------------------------- zeljko · 2016-08-25 18:32 You written everything except fpc version and database type, anyway, I'm using postgresql + ZEOS + Lazarus trunk (QtLCL) + fpc 3.0.0 (2.6.4 also worked fine) and never had such problems (linux, mac, windows). eg RQRY = zeos readonly query RQRY.SQL.Add('SELECT * FROM names WHERE name=:P1'); RQRY.Params[0].AsString := 'Željko'; RQRY.Active := True; .... works fine on any mentioned OS ...returns record ---------------------------------------------------------------------- djdjdjole · 2016-08-25 19:28 FPC is 3.0 and database is SQL Server 2012 Express. No matter I will try my luck with Zeos components, but still sounds strange to me that UniDAC (I understood that you pointed the finger to it) behaves differently in two mentioned situations. ---------------------------------------------------------------------- paweld · 2016-08-25 19:37 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Query.SQL.Text:='select * from mytable where name=:par0';//if "name" field type is varchar Query.Params[0].AsString:=UTF8ToCP1250('Šeki'); //add LConvEncoding unit to uses section//or if "name" field type is nvarcharQuery.Params[0].AsString:=UTF8ToUTF16('Šeki'); //add LazUTF8 unit to uses section ---------------------------------------------------------------------- djdjdjole · 2016-08-25 19:55 I've already tried that with no success. It sounds reasonable, because SQL Server's encoding format is UTF-16 (as much as I know) and Lazarus's one is UTF-8, but the problem is obviously somewhere else. ---------------------------------------------------------------------- djdjdjole · 2016-08-25 19:59 My excuse to paweld - I didn't noticed line number 3, which I didn't try . It should be first thing tomorrow. ---------------------------------------------------------------------- djdjdjole · 2016-08-26 07:35 The field is of "nvarchar" type in database and attempt with Utf8ToUtf16 doesn't work- returns no record. When building SQL query in source : SQL.Add('select * from myTable where name='); SQL.Add(QuotedStr('Šeki')); it does work- returns one record. ---------------------------------------------------------------------- zeljko · 2016-08-26 10:57 Have you tried to add {$codepage utf8} into that unit ? Maybe 'Šeki' is interpreted as cp1250 ... ---------------------------------------------------------------------- djdjdjole · 2016-08-26 17:26 Logical assumption, still it gives no solution. So I decided to build query in code- without parameters. ---------------------------------------------------------------------- paweld · 2016-08-26 18:16 try to use macros: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Query.SQL.Text:='select * from mytable where name=&mac0';Query.Macros[0].AsString:='Šeki'; ---------------------------------------------------------------------- djdjdjole · 2016-08-27 10:44 Simply no way- tried and returned no record. You guys are so kind and persistent - I have no words to express my gratitude. At the moment I found the way to override the problem (I already wrote about), but it still remains mystery to me.