- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi -
I can read integer data from a database. For example to read a 16-bit integer, I can use the following snippet
integer(2) :: dataField1
type(variant) :: vBstr1, vTName
integer(4) ADOField, ADORecSet
call $Recordset_Movenext(ADORecSet, status)
ADOField = Fields_GetItem(ADORecSet, vBSTR1, status)
vTName = Field_GetValue(ADOField, status)
dataField1 = vtName%vu%short_val
print *,"Field 1 ",dataField1
and everything works fine. But I can't figure out the "magic combination" to read text data. I can obtain the contents of the field with
ADOField2 = Fields_GetItem(ADORecSet,vBSTR2,status)
vTName = Field_GetValue(ADOField,status)
but can't figure out how to get from there to a string. I tried, for example,
character(50) :: dataField2
dataField2 = vTName%vu%char_val
print *,"Field 2 ",dataField2
but that just returns a single wide character. I looked for a string_val on vTName in the debugger but didn't find one. I suspect that I want to use the ptr_val of VTName and then ConvertBSTRToString, but so far I can't get the details correct.
Any help/references would be appreciated.
Thank you.
david
I can read integer data from a database. For example to read a 16-bit integer, I can use the following snippet
integer(2) :: dataField1
type(variant) :: vBstr1, vTName
integer(4) ADOField, ADORecSet
call $Recordset_Movenext(ADORecSet, status)
ADOField = Fields_GetItem(ADORecSet, vBSTR1, status)
vTName = Field_GetValue(ADOField, status)
dataField1 = vtName%vu%short_val
print *,"Field 1 ",dataField1
and everything works fine. But I can't figure out the "magic combination" to read text data. I can obtain the contents of the field with
ADOField2 = Fields_GetItem(ADORecSet,vBSTR2,status)
vTName = Field_GetValue(ADOField,status)
but can't figure out how to get from there to a string. I tried, for example,
character(50) :: dataField2
dataField2 = vTName%vu%char_val
print *,"Field 2 ",dataField2
but that just returns a single wide character. I looked for a string_val on vTName in the debugger but didn't find one. I suspect that I want to use the ptr_val of VTName and then ConvertBSTRToString, but so far I can't get the details correct.
Any help/references would be appreciated.
Thank you.
david
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greetings,
I am just guessing as I haven't seen your database, but the "TEXT" fields are probably stored as variable length character attributes(tuples). As I do not use ADO calls, I cannot give you the correct codes, but believe that there is one for what is known as a Varchar or Nchar.
I am just guessing as I haven't seen your database, but the "TEXT" fields are probably stored as variable length character attributes(tuples). As I do not use ADO calls, I cannot give you the correct codes, but believe that there is one for what is known as a Varchar or Nchar.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page