>Hi Dragan,
>
>It seems like my poor command over english is creating more problems than resolving the issues. I am therefore writing the whole code again (and this time full query) to save us both from anymore confusions.
>
>lha = SQLSTRINGCONNECT("driver=MySQL ODBC 3.51 Driver;server=192.168.2.2;uid=root;pwd=ctmroot;database=yesloans",.T.)
>
>lcQry = "Select u.userid Id, concat(u.firstname, ' ', u.lastname) Name, count(*) No_Of_App from yesloans.loans as l " + ;
> "join yesloans.users as u " + ;
> "on l.takenby = u.userid " + ;
> "join yesloans.customers as c " + ;
> "on c.customerId = l.customerId " + ;
> "where date(dateapplied)=date(now()) " + ;
> "and statuscomplete='Y' " + ;
> "and statusassessed='Y' " + ;
> "and statusapproved='Y' " + ;
> "and c.homeTypeId <> 5 " + ;
> "and statuscancelled='N' " + ;
> "and hour(timeapplied) = " + ALLTRIM(STR(ThisForm.txtHr.Value)) + ;
> " group by l.takenby"
>
>lnRes = SQLEXEC(lha, lcQry, 'cmpData')
>
>I have attached the code suggested by you immediately after "lnRes = SQLEXEC(lha, lcQry, 'cmpData')" and found the message that "Table yesloans.loans doesn't exist". Now this is confusing to me because if I change the sql connection
>
>lha = SQLSTRINGCONNECT("driver=MySQL ODBC 3.51 Driver;server=192.168.2.2;uid=root;pwd=ctmroot;database=yesloans",.T.)
>
>with
>
>lha = sqlconnect('mySQLODBC')
>
>the whole thing is working even though the length of lcQry is 411.
So it's something in the connectstring. When you connect using the latter method, what is the result of
?sqlgetprop(lha, "ConnectString")
Compare that with your connect string. See also message #
1270598 - the same thing, a bit longer.