Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Plse help me..

Plse help me..

Scheduled Pinned Locked Moved Visual Basic
databasehelpcsharpmysql
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    garga1
    wrote on last edited by
    #1

    I hv downloaded following codes to save image from vb.net 2005 to Mysql. Private Sub cmdSaveDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveDB.Click If picShowPicture.Image Is Nothing Then Exit Sub Dim ms As MemoryStream = New MemoryStream picShowPicture.Image.Save(ms, ImageFormat.Jpeg) Dim bytBLOBData(ms.Length - 1) As Byte ms.Position = 0 ms.Read(bytBLOBData, 0, ms.Length) Dim prm As New MySql.Data.MySqlClient.MySqlParameter("@BLOBData", _ MySql.Data.MySqlClient.MySqlDbType.Blob, _ bytBLOBData.Length, ParameterDirection.Input, False, _ 0, 0, Nothing, DataRowVersion.Current, bytBLOBData) Dim ConnectionString As String = "SERVER=localhost;" & _ "PORT=3306;DATABASE=pictureDB;User Id=root;" & _ "PASSWORD=pass;" Dim QueryString As String = "INSERT INTO blobtest ( BLOBData ) VALUES ( @BLOBData )" MsgBox(QueryString) Dim myConnection As New MySqlConnection(ConnectionString) Dim myCommand As New MySqlCommand(QueryString) myCommand.Connection = myConnection myCommand.Parameters.Add(prm) 'Open the connection myConnection.Open() 'Execute the query myCommand.ExecuteNonQuery() 'Close the connection myConnection.Close() End Sub But it is giving me a error saying imageformat is not declared.. How to solve it.. Plse help me..

    C G 2 Replies Last reply
    0
    • G garga1

      I hv downloaded following codes to save image from vb.net 2005 to Mysql. Private Sub cmdSaveDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveDB.Click If picShowPicture.Image Is Nothing Then Exit Sub Dim ms As MemoryStream = New MemoryStream picShowPicture.Image.Save(ms, ImageFormat.Jpeg) Dim bytBLOBData(ms.Length - 1) As Byte ms.Position = 0 ms.Read(bytBLOBData, 0, ms.Length) Dim prm As New MySql.Data.MySqlClient.MySqlParameter("@BLOBData", _ MySql.Data.MySqlClient.MySqlDbType.Blob, _ bytBLOBData.Length, ParameterDirection.Input, False, _ 0, 0, Nothing, DataRowVersion.Current, bytBLOBData) Dim ConnectionString As String = "SERVER=localhost;" & _ "PORT=3306;DATABASE=pictureDB;User Id=root;" & _ "PASSWORD=pass;" Dim QueryString As String = "INSERT INTO blobtest ( BLOBData ) VALUES ( @BLOBData )" MsgBox(QueryString) Dim myConnection As New MySqlConnection(ConnectionString) Dim myCommand As New MySqlCommand(QueryString) myCommand.Connection = myConnection myCommand.Parameters.Add(prm) 'Open the connection myConnection.Open() 'Execute the query myCommand.ExecuteNonQuery() 'Close the connection myConnection.Close() End Sub But it is giving me a error saying imageformat is not declared.. How to solve it.. Plse help me..

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Please read on how to ask good questions, 'please help me' is not a reasonable header. Everyone here wants help. Which line gives the error ? As the word 'ImageFormat' does not appear in the code you pasted, I assume it's not one of these lines ? Have you tried using the debugger ? This is what happens if you copy code off the web at random, articles and code snippets are great, but you need to take the time to understand them before you use them.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • G garga1

        I hv downloaded following codes to save image from vb.net 2005 to Mysql. Private Sub cmdSaveDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveDB.Click If picShowPicture.Image Is Nothing Then Exit Sub Dim ms As MemoryStream = New MemoryStream picShowPicture.Image.Save(ms, ImageFormat.Jpeg) Dim bytBLOBData(ms.Length - 1) As Byte ms.Position = 0 ms.Read(bytBLOBData, 0, ms.Length) Dim prm As New MySql.Data.MySqlClient.MySqlParameter("@BLOBData", _ MySql.Data.MySqlClient.MySqlDbType.Blob, _ bytBLOBData.Length, ParameterDirection.Input, False, _ 0, 0, Nothing, DataRowVersion.Current, bytBLOBData) Dim ConnectionString As String = "SERVER=localhost;" & _ "PORT=3306;DATABASE=pictureDB;User Id=root;" & _ "PASSWORD=pass;" Dim QueryString As String = "INSERT INTO blobtest ( BLOBData ) VALUES ( @BLOBData )" MsgBox(QueryString) Dim myConnection As New MySqlConnection(ConnectionString) Dim myCommand As New MySqlCommand(QueryString) myCommand.Connection = myConnection myCommand.Parameters.Add(prm) 'Open the connection myConnection.Open() 'Execute the query myCommand.ExecuteNonQuery() 'Close the connection myConnection.Close() End Sub But it is giving me a error saying imageformat is not declared.. How to solve it.. Plse help me..

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        You have to import the namespaces that the code uses. If you look up ImageFormat in the documentation, you see that it's in the System.Drawing.Imaging namespace.

        Despite everything, the person most likely to be fooling you next is yourself.

        G 1 Reply Last reply
        0
        • G Guffa

          You have to import the namespaces that the code uses. If you look up ImageFormat in the documentation, you see that it's in the System.Drawing.Imaging namespace.

          Despite everything, the person most likely to be fooling you next is yourself.

          G Offline
          G Offline
          garga1
          wrote on last edited by
          #4

          Thanks.. thanks a lot

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups