LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-08-2010, 03:07 PM   #1
Razorwings18
LQ Newbie
 
Registered: Jan 2010
Distribution: Debian Lenny
Posts: 4

Rep: Reputation: 0
Unhappy WINE + MSSQL 2000 + VB6 -> Numbers are rounded in recordset


Hi all,

I've got a "straightforward" database querying problem with a Visual Basic 6 application that happens on Debian (+WINE), but not on Windows XP.

SETUP:
* COMPUTER "FREE" with:
--- DEBIAN Lenny (Lang: Spanish)
--- unixODBC + FreeTDS for ODBC conectivity to remote MSSQL2000 (tested, working)
--- WINE 1.1.33
--- MDAC 2.8 (for channelling the ODBC connection through to unixODBC)

* COMPUTER "M$" with:
--- Windows XP (Lang: Spanish)
--- MSSQL Server 2000
--- MDAC 2.8

PROBLEM:
I create an ODBC connection to MSSQL2000 on VB6, and query a field (Numeric 9,2) into an ADODB.Recordset.
On Windows, the program returns the complete field numeric value (2.44), but on Debian it rounds the number (2.00).

On Debian, channelling the Query through isql properly returns 2.44, so it's most likely a WINE or VB6+WINE issue.

LITTLE VB6 TEST PROGRAM CODE (returns 2.44 on Windows XP, but 2.00 on Debian):
Code:
Private oConn As ADODB.Connection

Private Sub Command1_Click()
    Dim oRS As ADODB.Recordset
    
    Set oConn = New ADODB.Connection
    oConn.Open "DSN=myODBCDSN; UID=username; PWD=password;"
        
    Set oRS = New ADODB.Recordset
    
    oRS.Open "SELECT Price FROM GOODS WHERE idGoods = 10", oConn, adOpenDynamic
    MsgBox oRS("Price")
    
    oConn.Close
    Set oRS = Nothing
    Set oConn = Nothing
End Sub
The line oRS("Price") is where the problem is.

Any pointers will be most welcome. I am completely...uh... WTFed by this problem.
 
Old 01-08-2010, 03:30 PM   #2
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
that's probably wine bug. try searching in http://bugs.winehq.org/
maybe there's a workaround
 
Old 01-10-2010, 05:08 PM   #3
Razorwings18
LQ Newbie
 
Registered: Jan 2010
Distribution: Debian Lenny
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks. I checked all bugs related to SQL in general there and could find nothing related to my problem. I will upgrade to WINE 1.1.35 though and see what happens.
 
Old 01-10-2010, 05:09 PM   #4
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
Quote:
Originally Posted by Razorwings18 View Post
Thanks. I checked all bugs related to SQL in general there and could find nothing related to my problem. I will upgrade to WINE 1.1.35 though and see what happens.
1.1.36 came. it fixes some nice thing.
 
Old 01-10-2010, 05:25 PM   #5
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You might also want to consider:
1. Trying some output besides a message box
2. Explicitly casting the value to see if VB6 can read it as a floating point number. For example:
Code:
Private Sub Command1_Click()
    Dim oRS As ADODB.Recordset
    Dim x as Single

    Set oConn = New ADODB.Connection
    oConn.Open "DSN=myODBCDSN; UID=username; PWD=password;"
        
    Set oRS = New ADODB.Recordset
    
    oRS.Open "SELECT Price FROM GOODS WHERE idGoods = 10", oConn, adOpenDynamic
    x = oRS("Price")
    MsgBox x
    
    oConn.Close
    Set oRS = Nothing
    Set oConn = Nothing
End Sub
'Hope that helps .. PSM
 
Old 01-12-2010, 05:26 PM   #6
Razorwings18
LQ Newbie
 
Registered: Jan 2010
Distribution: Debian Lenny
Posts: 4

Original Poster
Rep: Reputation: 0
Well... I have updated WINE to the latest version and the problem remains.

Quote:
Originally Posted by paulsm4 View Post
You might also want to consider:
1. Trying some output besides a message box
2. Explicitly casting the value to see if VB6 can read it as a floating point number. For example:
Code:
Private Sub Command1_Click()
    Dim oRS As ADODB.Recordset
    Dim x as Single

    Set oConn = New ADODB.Connection
    oConn.Open "DSN=myODBCDSN; UID=username; PWD=password;"
        
    Set oRS = New ADODB.Recordset
    
    oRS.Open "SELECT Price FROM GOODS WHERE idGoods = 10", oConn, adOpenDynamic
    x = oRS("Price")
    MsgBox x
    
    oConn.Close
    Set oRS = Nothing
    Set oConn = Nothing
End Sub
'Hope that helps .. PSM
Thanks. Actually, this is just a test application. The Production app shows this problem in many parts of its code, and mainly the fields are loaded directly into Single or Double variables, some calculations are made, and the result is shown in many different ways (textboxes, listboxes, etc), so there is practically no chance for this to be an implicit Datatype conversion issue.

Last edited by Razorwings18; 01-12-2010 at 10:59 PM. Reason: missed a letter in a word
 
1 members found this post helpful.
Old 01-12-2010, 10:58 PM   #7
Razorwings18
LQ Newbie
 
Registered: Jan 2010
Distribution: Debian Lenny
Posts: 4

Original Poster
Rep: Reputation: 0
In WINE 1.1.35, native OLE DB support was added. Since I could not find a solution using ODBC, I switched to a OLE DB DSN-Less connection taking advantage of this brand new feature and tried again. It worked!

I could not find why ODBC gave me this problem, and now I can remain happily ignorant [hopefully].

Thank you all for your suggestions.
 
  


Reply

Tags
basic, classic, microsoft, mssql, sql, visual, wine


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wine & VB6 & flash8.ocx AbsoluteMonkey Linux - General 2 11-24-2009 08:50 PM
Re: error while installing VB6 via wine into CentOS5 bimmax Linux - Desktop 0 11-07-2008 10:06 AM
editing wine system.reg - what are the numbers? planetm Linux - Software 1 04-19-2006 03:10 AM
metacity window corners not rounded Gneisbaard Linux - Software 1 03-14-2006 02:20 PM
From a Fador REdhat web server to MSSQL 2000 llyr Linux - Networking 0 01-14-2004 05:22 PM


All times are GMT -5. The time now is 12:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration