AppendChunk Problem ???

AppendChunk Problem ???

Post by Brian Mitchel » Sun, 01 Apr 2001 12:16:31



I am using the AppendChunk method to take an image (.bmp) from file and add
it to an  Access table. However, as soon as my string gets appended to the
field, the size of the data in the field doubles (exactly doubles). Does
anyone out there have any ideas on this?

I have the same problem weather I am using SQL with a data type of Image or
Access with a data type of OLE.

Thanks!!

 
 
 

AppendChunk Problem ???

Post by ram » Sun, 01 Apr 2001 23:52:58


VB6 stores string as Unicode (16 bit), so every other byte is 0 for Ansi code
(English). Some
languages like korean uses both the bytes.
Hope this explains.
-Ram

> I am using the AppendChunk method to take an image (.bmp) from file and add
> it to an  Access table. However, as soon as my string gets appended to the
> field, the size of the data in the field doubles (exactly doubles). Does
> anyone out there have any ideas on this?

> I have the same problem weather I am using SQL with a data type of Image or
> Access with a data type of OLE.

> Thanks!!


 
 
 

1. AppendChunk problems

I am experiencing an intermittent, but reproducible problem using the
AppendChunk method on an ADO database in VB6.  This is happening both on my
Win98 development box and my Win95 production box.  I'm running VB6 SP 5.
The database in a Access 97 database.

The code takes in data from the Winsock port and appends it to a memo field
using the AppendChunk method.  The relevant code is:

Dim SMTPConn As ADODB.Connection, SMTPRS As ADODB.Recordset
.... some code and functions here ...
    Set SMTPConn = CreateObject("ADODB.Connection")
    SMTPConn.Open ("Driver={Microsoft Access Driver
(*.mdb)};DBQ="Mydatabase.mdb";")
    Set SMTPRS = CreateObject("ADODB.Recordset")
    SMTPRS.Open "SELECT * From MailLog WHERE [Message Number] = -1 ",
SMTPConn, 3, 3

... some more code to open ports, pass commands and get data ...
    SMTPRS.AddNew
    SMTPRS.Fields("Message Status") = "Loading"
.. a bit of processing to receive data from the ports using the AppendChunk
method on the field "Body" ...

     Dim Buffer As String
     SMTP_Server_Winsock.GetData Buffer
     SMTPRS.Fields("Body").AppendChunk (Buffer) '-- this line blows up when
writing the last bit of the buffer, especially when it is really short
     SMTPRS.Update

I've tried a number of work-arounds and the code works 98% of the time but
I've got one particular scenario where the last bit of data is short where
it blows up.  The error I get is:

VB6 caused an invalid page fault in
module KERNEL32.DLL at 017f:bff7a125.
Registers:
EAX=0fd6267c CS=017f EIP=bff7a125 EFLGS=00010212
EBX=0fe9ef74 SS=0187 ESP=007fe690 EBP=007fe6d0
ECX=0fd6000c DS=0187 ESI=0fd6267c FS=117f
EDX=00100000 ES=0187 EDI=0013c8f8 GS=0000
Bytes at CS:EIP:
8b 03 a8 01 74 25 25 fc ff ff 0f 8b 53 08 03 f8
Stack dump:
007fe6d0 0013c8f8 0fd61374 00001308 bff7a3a0 0fd60000 0fd6267c 0013c8f8
00000000 0fd6000c 0fd60000 0fd61374 00000000 00000000 0000fe9e 0000fd62

The page fault address seems to always be the same.

Thanks for your help.

--
Andrew Butchart

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

2. Request for Image File Plug-in/Utility

3. VB+Stored Proc - Appendchunk problem???

4. How to Lock in ODBC

5. Using AppendChunk problem

6. %free & %used

7. Saving an image with AppendChunk problem

8. - ::Oracle Database Administrator:: Portland, Oregon jw005002

9. Weird AppendChunk problem

10. DAO getchunk/appendchunk problems in Access 97 DB

11. Saving an image with AppendChunk problem

12. VB+Stored Proc - Appendchunk problem???

13. AppendChunk problem in ADO