using storing byte array on a mysql blog field


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: using storing byte array on a mysql blog field

  1. #1
    Join Date
    Jun 2007
    Posts
    113

    Unhappy using storing byte array on a mysql blog field

    i made a sub to store the byte array on a blog im using mysqldriverCS

    but i get this ugly exeption

    A call to PInvoke function 'MySQLDriverCS!MySQLDriverCS.CPrototypes::mysql_real_escape_string' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

    this its y sub

    Code:
            Dim DBCon As MySQLConnection
            DBCon = New MySQLConnection(New MySQLConnectionString(DBHost, DBNombre, DBLogin, DBPassword, DBPuerto).AsString)
            Try
                'Connection
                DBCon.Open()
                '........
                Dim sql As MySQLCommand = New MySQLCommand
                sql.Connection = DBCon
                'if doesnt exist its inserted else its updated
                If ACount("CBiCom", "CBiNombre", Nombre) > 0 Then
                    sql.CommandText = "INSERT INTO CBiCom VALUES(@Par1, @Par2)"
                Else
                    sql.CommandText = "Update CBiCom CBiValor=@Par2);"
                End If
    
                Dim Barr(CInt(Valor.Length - 1)) As Byte
                Dim Par1 As New MySQLParameter("@Par1", DbType.String)
                Dim Par2 As New MySQLParameter("@Par2", DbType.Byte)
                'Conversion from FileStream to Byte Array
                Valor.Read(Barr, 0, Barr.Length)
                Valor.Close()
    
                'Asigning value to the parameters
    
                Par1.Value = Nombre
                Par2.Value = Barr
    
                sql.Parameters.Add(Par1)
                sql.Parameters.Add(Par2)
                sql.CommandType = CommandType.Text
                sql.ExecuteNonQuery()
    
                'closing
                DBCon.Close()
    does anyone knows what im doing wrong?

    Last edited by Alphadan; 07-29-2007 at 03:47 PM.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    It doesn't look like you are doing anything wrong. I suspect a bug in the MySQL driver you're using. Can you contact the vendor for technical support? Is it possible to use a different driver?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jun 2007
    Posts
    113
    yes its a bug on the driver, weird thing its i browsed on google and found another guy with the same problem and the solution its to use a older version of the same driver it works with the older one but i wonder if would it have another bugs.

    im using "MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0"

    its free and open source.

Similar Threads

  1. string to byte array
    By aks79 in forum VB Classic
    Replies: 2
    Last Post: 05-23-2006, 11:50 AM
  2. Replies: 2
    Last Post: 06-18-2002, 09:15 AM
  3. Replies: 0
    Last Post: 04-04-2002, 06:46 PM
  4. How to pass byte array to vc++ dll
    By Mc.Mohan in forum VB Classic
    Replies: 2
    Last Post: 09-28-2000, 01:54 PM
  5. How to pass byte array to vc++ dll
    By Mc.Mohan in forum VB Classic
    Replies: 0
    Last Post: 09-28-2000, 11:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center