|
-
Jul 14th, 1999, 02:01 PM
#1
Thread Starter
New Member
Hi all
I'm having a bit of trouble with my VB6 app which uses DAO to connect to an Oracle database via ODBC. The app is basically a data manipulation tool, it takes data from a source database and converts it into different formats for several destination databases.
The problem is : at one point in the app I need to find the type (date, string, number etc) of a field in a row in a recordset.
I have tried using field.type and also typename(field.value). Both of these things work correctly for dates and strings, but when I try a field which is defined as a number in the Oracle database, both commands say it's a string. When I 'watch' the field, it's type property actually says 'variant/string'.
So my question is : is there a way of correctly getting the field type?
(I can't use IsNumeric because the details about the fields I'm manipulating are stored in the database too, and there are other fields which are defined as varchars but might only contain numeric data).
If anyone knows, please tell me!! Either on this group or at [email protected]
Thanks
Colin
-
Jul 15th, 1999, 03:04 PM
#2
Lively Member
I use the .Type property for this and it seems to work. Are you using the proper constants to compare with? For instance, there is vbString (8) and dbText (10). The db prefixed constants are correct here.
Good luck
Bash
-
Jul 15th, 1999, 09:26 PM
#3
Thread Starter
New Member
Thanks for replying!
Yes - when I debug.print the field.type and the typename(field.value), I can see the correspondence between the two. I don't think my problem is anything to do with the type or typename commands, it's more to do with the translation between the database and my application - something is being lost along the way.
I have found a solution however - the Oracle dictionary view user_tab_columns contains details about columns in tables including the column name, table name and data type. I can read these back into a recordset, and search through that recordset when I need to get the type of a field in a table.
Colin
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|