Have you taken a look at the structure (LIST STRU) of the resultant cursor when you get the incorrect result? Perhaps there's a clue there.
On Fri, Mar 25, 2016 at 11:00 AM, rafael copquin rcopquin@fibertel.com.ar wrote:
A few months ago I posted the following:
quote
I am selecting a bunch of invoices from a MS SQL Server table. I just want to add the total of all invoices. In the management studio I do this: Select sum(total) as total from terbo.dbo.invoices I get 212649.17 When I do the same calculation in VFP cCmd = ‘Select sum(total) as total from terbo.dbo.invoices’ sqlexec(thisform.nHandle,cCmd,’curTotals’) nTotal = curTotals.total nTotal is 212.65 How can I get the correct amount? unquote
I would still know the answer to this problem, because the weird thing is that it only happens with the tables of just one database. That is, I have two similar databases, with similar tables. However, the vfp cursor obtained from this particular database table gives the above error where a similar table in another database does not.
In both my Windows 10 and VFP9 SP2 the regional settings are a dot as a thousands separator, a comma as a decimal point and a semicolon as lists separator. These are the Spanish language settings for numbers
The numerical fields in the tables are defined as numerical (18,2) not null with a default value of 0
A select statement such as this:
cCmd = 'select invtotal from mydatabase.dbo.invoices where invid = '+transform(nPK) sqlexec(nHandle,cCmd,'curInvTotal')
brings a cursor where a browse shows 12.256,85 (note the dot shown as a thousands separator. It should show as 12256,85) If I place the mouse over the invtotal column on the browse, the number shows as 12.25
I am really baffled and do not know what to do.
Any leads on where to tweak the database on SQL Server, or configure the software would be appreciated
Any help?
Happy Easter
Rafael Copquin
Rafael Copquin
[excessive quoting removed by server]