Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variant Data Type vs. Integer
Message
General information
Forum:
Visual C++
Category:
Other
Miscellaneous
Thread ID:
00247497
Message ID:
00247567
Views:
18
Wrap Var2 in the CInt() function to typecast the variant. It would look like this:

MyVar = MyVar + CInt(Var2)

>I'm accessing a MS SQL table and assigning its records to variables.
>It goes something like this:
>
>MyVar = 0
>
>Var2 = Recordset1("Field1") 'Field1 is numeric
>
>MyVar = MyVar + Var2
>
>The browser reports: 'data type mismatch'
>When I debug in Interdev, I notice that MyVar's type is integer and Var2's type is Variant. How do I get around this? The table contains mostly numeric data fields.
>
>I would really appreciate it if anyone can help me on this since I'm new at Visual Interdev and MS SQL.
>
>Thanks
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Previous
Reply
Map
View

Click here to load this message in the networking platform