已答覆 Database resutls confusion in VB 2005

  • martes, 01 de mayo de 2012 21:37
     
     

    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.

    • Cambiado Bob_BaoMVP jueves, 03 de mayo de 2012 7:47 (From:Visual Basic General)
    •  

Todas las respuestas

  • martes, 01 de mayo de 2012 22:38
     
     

    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

  • martes, 01 de mayo de 2012 23:04
     
     

    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

  • miércoles, 02 de mayo de 2012 6:49
     
     Respuesta propuesta

    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

  • miércoles, 02 de mayo de 2012 11:45
     
     
    Thanks, I will. I appreciate you looking at it, anyway.
  • miércoles, 02 de mayo de 2012 12:40
     
     Respondida

    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)


  • miércoles, 02 de mayo de 2012 14:34
     
     
    Thank you for the suggestions. The Sybase idea is particularly intriguing.
  • jueves, 03 de mayo de 2012 6:50
     
     

    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