Page 1 of 1

LAZARUS 1.2.4 and UniDAC MSSQL access

Posted: Sat 20 Sep 2014 08:12
by tmac
Hello,

I need to connect to the database using MSSQL Express 208 UniDAC 5.3.9 for Lazarus.

Problem: SQL insert query editor / manager will be OK as query query below

Code: Select all

SELECT dbo.SKz.ID,dbo.SKz.RefSklad,dbo.SKz.RefStruct,dbo.SKz.IDS,dbo.SKz.Nazev,dbo.SKz.MJ,dbo.SKz.StavZ,dbo.SKz.ObjedP,dbo.SKz.ObjedV,dbo.SkSt.Vetev1,dbo.SkSt.Vetev2,dbo.SkSt.Vetev3,dbo.SKz.Reklam,dbo.sSklad.SText FROM dbo.SKz INNER JOIN dbo.sSklad ON dbo.SKz.RefSklad = dbo.sSklad.ID INNER JOIN dbo.SkSt ON dbo.SkSt.RefSklad = dbo.sSklad.ID AND dbo.SKz.RefStruct = dbo.SkSt.ID WHERE ((dbo.SKz.IDS LIKE '60082%') AND (dbo.SKz.Nazev LIKE '%'))
Calls using the same query ->

Code: Select all

DataModule1.sqSebekHlavni.SQL.Text = sQueryH; // SQueryH contains the above query
DataModule1.sqSebekHlavni.ExecSQL;
Reports an error connecting to the database. Can someone please advise me. UniConnection is of course Connected = true

Re: LAZARUS 1.2.4 and UniDAC MSSQL access

Posted: Mon 22 Sep 2014 12:02
by azyk
Thank you for the information. We have reproduced the problem when the design-time SQL editor in TUniQuery doesn't save the content, and we will investigate it.
tmac wrote:Reports an error connecting to the database. Can someone please advise me. UniConnection is of course Connected = true
To avoid this error, before executing the query, set the TUniQuery.Connection property of the sqSebekHlavni component to the TUniConnection you are using. For example:

Code: Select all

DataModule1.sqSebekHlavni.Connection := DataModule1.UniConnection1;
Note: if you use Windows Authentication at connection to SQL Server, you should set the TUniConnection.SpecificOptions.Values['Authentication'] option to 'auWindows'.

Re: LAZARUS 1.2.4 and UniDAC MSSQL access

Posted: Mon 22 Sep 2014 12:07
by tmac
UniDAC use in the current version. Connecting the Delphi XE6 works for me but this code in Lazarus does not connect to MSSQL database. In design mode connection is working and data are available, after the translation or in debug mode displays an empty grid.

Re: LAZARUS 1.2.4 and UniDAC MSSQL access

Posted: Mon 22 Sep 2014 12:53
by azyk
Unfortunately we couldn't reproduce the problem. Please try to compose a small sample to demonstrate the problem and send it to andreyz*devart*com, including a script to create and fill a tables.