Results 1 to 24 of 24

Thread: Lost Connection to MySQL server during query

Threaded View

  1. #1

    Thread Starter
    Addicted Member g-mie's Avatar
    Join Date
    Jan 2004
    Location
    EarTh
    Posts
    212

    Lost Connection to MySQL server during query

    I am using MySQL server 3.51 database. I am insert/update image into database as follow;
    VB Code:
    1. Private Sub insertupdate_image()
    2.     Dim MyStream As ADODB.Stream
    3.     Set MyStream = New ADODB.Stream
    4.     MyStream.Type = adTypeBinary
    5.     MyStream.Open
    6.     MyStream.Position = 0
    7.    
    8.     Dim sTemp As String
    9.     Dim MyData As Variant
    10.        
    11.     sTemp = "C:\SPAI_Temp\HMDaftar" & intHMDaftarID & ".jpg"
    12.     If pPicture = 0 Then Exit Sub
    13.     VB.SavePicture pPicture, sTemp
    14.     MyStream.LoadFromFile sTemp
    15.  
    16.     Dim Rs As ADODB.Recordset
    17.     Set Rs = New ADODB.Recordset
    18.     query = "Select Gambar,HMDaftarID From t_HMGambar where HMDaftarID=" & intHMDaftarID
    19.     Rs.Open query, db, , adLockPessimistic
    20.    
    21.     With Rs
    22.         If .RecordCount > 0 Then
    23.             .Fields!Gambar = MyStream.Read
    24.             .Fields!HMDaftarID = intHMDaftarID
    25.             .Update
    26.         Else
    27.             .AddNew
    28.             .Fields!Gambar = MyStream.Read
    29.             .Fields!HMDaftarID = intHMDaftarID
    30.             .Update
    31.         End If
    32.         .Close
    33.     End With
    34.  
    35.     MyStream.Close
    36.     Set MyStream = Nothing    
    37. End Sub

    It is work well if I insert or update image that size below then 30Kb.

    BUT, it is giving "Lost Connection to MySQL server during query" error if I insert or update image that the size above 30Kb.
    What should I do?

    Thanks
    Last edited by g-mie; Jan 14th, 2007 at 10:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width