Results 1 to 3 of 3

Thread: Picturebox to sql database

  1. #1

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172

    Picturebox to sql database

    Can anybody help me with creating a binary "whatever" from an image (in picturebox or from file don't mind) , then putting that into a mysql database? :S


    edit :

    i dont mind if its binary or something.. as long as it working :P


    this is what i have now.....

    VB Code:
    1. Dim objStream As Stream = File.Open("c:\handje.gif", FileMode.Open)
    2.         Dim buffer(objStream.Length) As Byte
    3.         Dim x As String
    4.  
    5.         Con = New ADODB.Connection
    6.         Con.Open("driver=MySQL ODBC 3.51 Driver;server=nc2;user=admin;password=sqrl;database=photozone")
    7.         objStream.Read(buffer, 0, objStream.Length) : objStream.Close()
    8.         x = System.Text.ASCIIEncoding.ASCII.GetString(buffer)
    9.         Dim enc As New System.Text.ASCIIEncoding
    10.  
    11.         Con.Execute("INSERT INTO layers (eid,source) VALUES ('1' , '" & x & "')")

    /\ it fails at the con.execute.. because of the X value :S
    Last edited by Ultimasnake; Nov 7th, 2003 at 10:00 AM.
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  2. #2
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245
    Is the column in the table set to be a BLOB (binary large object)?
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

  3. #3

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172
    tried almost every thing logical...
    i tried it with a .gif file.. and it fails at the 6th character or so (as far as Sql errors are clear)....
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

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