Database resutls confusion in VB 2005
-
Tuesday, May 01, 2012 9:37 PM
I have a vb 2005 program which runs a SQL query and processes the results to create a spreadsheet where every table row is an Excel row. The DB is Sybase 11.9.2 and Excel is Office 2010. There is a sngle column in the query resullts that is giving me fits. The Syvase SQL Advantage for one row for an example of this column is:
SELECT contract_qty from TRADE_SUMMARY where trade_num=492223
contract_qty
------------------------
22,500,000.00
In Sybase, this field is defined as Money and 8 digits. In VB, I execute iQty=Rst("contract_qty").value where rst is the recordset name ad iQty is an integer variable. All I get back is the significant digits 225. I've also tried using a single variable and a decimal variable and converting them but all I get are the significant digits whichever variable type I use. Does anyone know what I am doing wrong? This is driving me nuts. With just the signifcant digits I don't have a clue as to how much to multiple it by to get the actual quantity.
- Moved by Bob_BaoMVP Thursday, May 03, 2012 7:47 AM (From:Visual Basic General)
All Replies
-
Tuesday, May 01, 2012 10:38 PM
Hello BGCSocal,
RST is in fact not actual VB2005, it is using a kind of compatible mode of VB 8 (2005)
The recordset is in fact no actual type anymore, so tell a little bit more what you want to achieve.
Success
Cor -
Tuesday, May 01, 2012 11:04 PM
I'm connect to the DB, then via a select statemnt (sSQL) get a recordset. Then I get the returned column values row by row to create an Excel spreadsheet row. The quantity field is giving me back the significant digits only so I have way ti know what the actual quantity is. I've evn tried gett the value.tostring and I still only get the significant digits . in the case aboe that is 225, but how does the program know whether this is 22,500 or 225,000 or what? [Pardon the apcing and lack of line feeds below. This reply does not like copying in stuff at all.]
Public Connect As New ADODB.Connection
Public Rst As New ADODB.Recordset
Connect.ConnectionString =
"DSN=TP;uid=sa;pwd=xxxxxx"
Connect.Open()
Rst.Open(sSQL, Connect)iQty=Rst("contract_qty").value
-
Wednesday, May 02, 2012 6:49 AM
I did not see Kevin who mostly handles these problems some days. Therefore try your problem in this forum where the experts for your problem live.
http://social.msdn.microsoft.com/Forums/en-US/vsto/threads
Success
Cor- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Moderator Thursday, May 10, 2012 8:00 AM
-
Wednesday, May 02, 2012 11:45 AMThanks, I will. I appreciate you looking at it, anyway.
-
Wednesday, May 02, 2012 12:40 PM
You may also want to check with the Sybase community since it would appear to be a Classic ADO/Sybase issue:
http://www.sybase.com/support/community-forums
Paul ~~~~ Microsoft MVP (Visual Basic)
- Edited by Paul P Clement IVMVP Wednesday, May 02, 2012 12:41 PM
- Proposed As Answer by Mark Liu-lxf Thursday, May 03, 2012 2:39 AM
- Marked As Answer by Mr. WhartyMicrosoft Community Contributor, Moderator Thursday, May 31, 2012 6:09 AM
-
Wednesday, May 02, 2012 2:34 PMThank you for the suggestions. The Sybase idea is particularly intriguing.
-
Thursday, May 03, 2012 6:50 AM
Hi BGCSOCAL,
Welcome to the MSDN forum.
I’m afraid that the issue about connect to Sybase is out of scope here. I will move this thread to off-topic thread. Please follow Paul’s redirection to post your thread to the official website of Sybase.
Sorry for any inconvenience and have a nice day.
Mark Liu-lxf [MSFT]
MSDN Community Support | Feedback to us

