
March 7th, 2007, 01:53 PM
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 1
Time spent in forums: 13 m 24 sec
Reputation Power: 0
|
|
|
Decimal scalar function?
I don't really know much 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 been able to get data fine the only problem is that i can't 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 am I in the wrong forum?
I would greatly appreciate any help...
|