Re: Retrieving CLOB field???
- From: "Rod da Silva" <RodDaSilva@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 25 Sep 2005 10:15:50 -0400
Is your CLOB field a text or ntext field? If ntext then it is Unicode which
might explain the "junk" you are seeing (if it is every other charcter for
example). You might try different encodings to see if that helps or using
notepad open the file as Unicode.
BTW, is your CLOB field the _last_ field of your XMLSUBSCRIBE table by any
chance? I am having a problem my CLOB fields (see recently posted thread
"ActualSize returns -1 for Text fields") in which I can only get things to
work if the CLOB field is the last field of the table.
Rod
"Chakkaradeep" <Chakkaradeep@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:600AC974-DC37-4085-928E-51C449CFD9BE@xxxxxxxxxxxxxxxx
> hi all,
>
>
> i have written a program to connect to the database and retrieve
> values,i also have a CLOB field which contains XML data, i want to
> retrieve that also...how do i do that using ADODB..here is the code.,
>
>
> ********************VB Code Starts here*************************
> Set loDBAccess = New CDBAccess
> Set loRsXMLPub = New ADODB.Recordset
> lstrQueryStr = "select * from XMLSUBSCRIBE where SUB_TEXT_CONV_FLAG =
> '0'"
> Set loRsXMLPub = loDBAccess.fnRetriveQueryResult(lstrQueryStr)
> lnRecCount = loRsXMLPub.RecordCount
> lnRecCount = 0
> Do While Not loRsXMLPub.EOF
> ' Create the ADO Stream object
> Set loStream = New ADODB.Stream
> ' Set the character set for you particular type of text data
> loStream.Charset = "us-ascii"
> ' Make it a text type
> loStream.Type = adTypeBinary 'adTypeText 2
> ' Open the stream
> loStream.Open
> ' This writes the text file from the clob field to the buffer
> loStream.WriteText loRsXMLPub.Fields("SUB_XMLORD_DOC")
> ' This saves the stream to a file on disk
> loStream.SaveToFile lstrTempFileToSave, adSaveCreateOverWrite
> '& loRsXMLPub.Fields("SUB_XMLORD_DOC").Value
> loStream.Close
> Set loStream = Nothing
> mnMessageID = loRsXMLPub.Fields("SUB_SL_NUM").Value
>
>
> 'Save the XML document to text file
> loRsXMLPub.MoveNext
> Loop
> ********************VB Code Ends Here*************************
>
>
> everything works fine but when i check the file which has been saved, i
> see a lot of junk characters along with the original xml file and thus
> am not able to load that XML file..the CDAccess class module works fine
> for every other field except for the clob field..
>
>
> i would be happy if someone could help me out...
>
>
> thanks in advance,
>
>
> with regards,
> Chakkaradeep
>
>
>
.
- Prev by Date: Re: ActualSize returns -1 for Text fields
- Next by Date: how to know wat is the data source name.
- Previous by thread: Re: Getting the correct date format from SQL-Server 2000
- Next by thread: how to know wat is the data source name.
- Index(es):