I know this topic may already have been discussed but the links on the page returned by the search tool were not working so i decided to post my simple question instead.
I don't really know anything about DB2 (im not even sure if im in the correct forum) but I'm quering data from an IBM i5 server using visual basic 6 and ADO. I have got it to work fine the only problem is that i cant get decimal type data to return as a decimal. I use a program called Query, made by SPSS, to find the data type and size of fields in a table. According to the Query program, the field i am trying to get is of type Decimal and has a size of 15 and scale of 2. So I tried using the DECIMAL scalar function to return the field in decimal form but instead of getting 123.45 I get 12345 (no decimal).
Here is the code i use to connect to our server:
Code:
Global gConn As New ADODB.Connection
gConn.Provider = "IBMDA400"
gConn.Properties("Force Translate") = 0
gConn.Open "Provider=IBMDA400;Data Source="MyServer", "User","Password"
Here is the code i use to query the data:
Code:
Dim rs As ADODB.Recordset
Dim Parms As Variant
....
strSQL = "SELECT DECIMAL(LIPQOH,15,2) From DLFDTA57.F41021 F41021"
Set rs = gConn.Execute(strSQL, Parms, -1)
MyString = rs.GetString(adClipString)
The field LIPQOH never returns as a decimal, I've tried various values for the precision and scale parameters of the DECIMAL function but none return the field as a decimal. Am i using the funtion incorrectly? Should i be using a different function? Or even worse am i in the wrong forum?
I would greatly appreciate any help...