compare of dbText type and numeric (long) type .. 
Author Message
 compare of dbText type and numeric (long) type ..

VB40 pro,ODBC

  in the code following;

adresrecset is a recordset with 79 records
CBIlC is a Combo box with a clone of adresrecset

OK i made a mistake and compared a numeric ( long) type
against  string (dbtext).

But in the beginning of the loop
  0 th Combo item = 2811
  value of recordset is "ANKARA"      

  so (2811 = ANKARA) is always true

   For i = 0 To ?llerRecSet.RecordCount - 1
        If (CBIlC.ItemData(i) = AdresRecSet("ILKOD")) Then
            CBIlC.Text = CBIlC.List(i)
            Exit For
        End If
    Next

'**
Then i changed the code as below.

    For i = 0 To ?llerRecSet.RecordCount - 1
        Dim a1 As Variant, a2 As Variant
        a1 = CBIlC.ItemData(i)
        a2 = AdresRecSet("ILKOD")
        If a1 = a2 Then
            CBIlC.Text = CBIlC.List(i)
            Exit For
        End If
    Next

so in these case  (2811=ANKARA) is false

'
anyway i solved the problem. but i need some
explanation.

TIA for any comment

Niyazi Atakan




Sat, 06 Nov 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Data type conversion error when saving numeric data types

2. Type Mismatch - Array of Type Long

3. Prob. w\ TYPE data type: err:Type Mismatch

4. Error in ADO2.1 and Sybase Data Type Numeric (16,4)

5. Storing very large numeric arrays in the database (OLE OBJECT Data Type)

6. numeric data types

7. AS400 and Packed numeric Data Types

8. Numeric data type in VB 4.0

9. Parameters and numeric type problem

10. Please help - howto set the precision and numeric scale for a decimal type parameter

11. Using ADO to Connect to Excel returns null for numeric types

12. Numeric type coercion difference between VB5 & VB6

 

 
Powered by phpBB® Forum Software