How to insert image file to Mysql use VB.NET


I'm using VB.NET and Mysql for my application. I want to insert image file to Blob field in table. Who can help me?
9/21/2002 1:43:32 AM 1929 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 2

web forms or windows forms?
11/30/2004 5:54:25 PM


I tried to insert file in MySql database using VB.NET. I hope the same code should work with Image file too.


1    Dim conn As OdbcConnection
2    Dim comm As OdbcCommand
3    Dim dr As OdbcDataReader
4    Dim sql as String
5    Dim binData() As Byte
6    Dim fs1 As New FileStream _
7    (“C:\dsr-videp\A.avi”, FileMode.OpenOrCreate, _
8    FileAccess.Read)
10   fs1.Read(binData, 0, fs1.Length)
11   fs1.Close()
14   conn = New OdbcConnection("DSN=mydsndb")
15   conn.Open()
17   sql = "INSERT INTO " & tablename & "(id, blob_file) values(NULL, ?)"
18   comm = New OdbcCommand(sql, conn)
19   commServerBox.Parameters.Add("@blob_file", aData)
21   comm.ExecuteNonQuery()
22   conn.Close()
23   comm.Dispose()
2/16/2007 12:39:27 PM

could you explain abit,



7/11/2008 11:50:04 AM

Similar Artilces:

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Currently have a site coded in PHP but the customer wants to go to .NET. Can I use the existing MySQL DB or am I required to use MSSQL? Thanks, Ken Check out this forum which is specialized for this kind of questions: ASP.NET MySQL forumBart De Smet [MVP] Visit,

Insert and show unicode data using VB.NET and MySQL 4.1
Hi, I'm trying to make a web page in my language. I'm using unicode font. I have a form that to insert unicode text into MySQL database. I inserted the text "শুনতে চাইলে" using code:   MyCommand.Parameters.Add(New MySqlParameter("?titleBN", Encoding.UTF8.GetBytes(txtTitleBN.Text)))   After inserting it in database it looks like "শুনতে চাইলে". Now when I'm trying to read this using code: txtTitleBN.Text = Encoding.UTF8.GetString(DataReader.Item("Col1")) I'm not getting the right value. If I co...

Insert datetime, using
Hello there,I got a little code there are inserting a record into my msSQL database..But i cant insert the datetime, for one reason?The problem is in line 7 () where i want to insert DateTime.Now 1 Protected Sub SendPmTilAfviste(ByVal modtager As String, ByVal festID As String) 2 ' Connection 3 Dim conn As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True") 4 conn.Open() 5 6 ' SQL-kommandoen 7 Dim cm...

I need to insert data into a mySQL 4 DB using ODBC, and I'm using .NET 1.1
I think the subject line pretty much clears up what I need to do.  I've included the code below that I have so far, I think I've got the connection right, but I don't know how to insert the data in the table when the command button is clicked.  Any help would be much appreciated.  Thanks.<%@ Page Language="VB" AutoEventWireup="False"  EnableSessionState="False" EnableViewState="False" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.Odbc" %><%Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=con...

storing images in MySQL database with
Hi All, I want to store images in MySQL database through a web page in I could not find any article in with Some body has done or knows the solution then tell me the article Thanx in advance Hussain Shah You could upload the file onto your server, and have a field in your database pointing to the directory/filename.Microsoft ASP.NET Enthusiast This article is not VB but not hard to understand , reading this maybe help . Don't forget to click "Mark as Answer" on...

Data synchronization in MySQL using
Hi all..... Is data synchronization available in MySQL ? If can i do it ? i wanna to update both database in different server once some actions of my system is carried.... Language that i used for my system is kindly post here if anyone got the solutions or ideas.... (please recommend me if there is any suitable tools for this)thanks...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

converting 2003 files to 2005
Hi, i am beginner..i watch videos about made on 2003 when i wrote these codes in 2005 ,it gives there any program which convert the code automatically?   thanks,Thanks,Speranza What videos are you talking about?  There are lots of great, up-to-date ASP.NET Videos on this site for free.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! i am talking about videos..Thanks,Speranza Speranza:they made on 2003 when i wrote these codes in 2005 ,it gives there a...

Error in using a VB.NET .exe file on a computer that hasn't studio net installed
I've create an VB.Net Console Application and i'm trying to make the exe run on another computer that has, let's say windows 98. i've installed on this computer the net framework but it doesn't seem to be enough. what do i have to install also? i've used the following references in my application (if it has anything to do with this): Imports System.IO Imports Excel = Microsoft.Office.Interop.Excel I've also copied on the test computer Microsoft.Office.Interop.Excel.dll in the same folder as the exe file. It doesn't give so many error, but one: Object reference not set to an inst...

How to insert Image (jpeg) into MS Word Programmatically using VB.NET
Hi there, Can someone help me on How to insert Image (jpeg) into MS Word Programmatically using VB.NET..not C#.NET??? I could hardly find any articles for the coding. Preferably using Bookmark...can i have the sample code. Thanks,    Which version of Word please? The latest version can work with an XML format that makes inserting an image quite easy!Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. ...

I want to use VB.NET with a MySQL database. I have NO idea what the consqeuences are with regard to connection strings etc. Does anyone have good examples of how to set all this up?please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already. Just to see if it is helpful to you. Regards,Wilson Ng @Hong Kong SAR...

MySQL with VB.NET?
This is getting frustrating because i want to connect to mysql databases to i tried looking on the net but all they ask you is too type all those commands in? i understand i have to get the net connector thingy but i cant just press "add new connection" in and just click on mysql? can someone help me?  Err, coding generally involves typing...If you are using VS.NET you can try the Server Explorer.  I've never used it, so I don't know what it does, but it seems like perhaps what you want.HTH, rchern.Churned Ajax ToolkitPlease choose "Mark as Answ...

How to convert .tiff image file to .pdf file without using any 3rd party tool using
HI allI have a urgent requirement i want to convert .tiff image to .pdf file Thanks in advance Regards RaviPlease click "mark as answer" if this post helped you. I dont think its possible without doing a lot of code or using third party tools, but if you  are looking for a free tool you can try a combination of Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answer" for this pos...

Web resources about - How to insert image file to Mysql use VB.NET -

Insert key - Wikipedia, the free encyclopedia
The Insert key (often abbreviated INS ) is a key commonly found on computer keyboards . It is primarily used to switch between the two text-entering ...

Inserts Wallpapers & Photos on the App Store on iTunes
Get Inserts Wallpapers & Photos on the App Store. See screenshots and ratings, and read customer reviews.

hud-dot-epa south lincoln insert - Flickr - Photo Sharing!

Lumia 640 XL - How to insert SIM and memory card - YouTube
Learn how to get started with your Lumia 640 XL or Lumia 640 XL Dual SIM. In this video you'll learn how to insert the SIM cards and the memory ...

Google Maps prankster inserts image of Android robot urinating on Apple logo
It seems even Google Maps can fall victim digital vandalism.

Dear [insert name], Qantas takes your complaint very seriously, honest
What's more annoying than being delayed nine hours on a long-haul flight between Sydney and Los Angeles, while stuck in a seat with a broken ...

Skype to insert advertising into calls
Skype to insert advertising into calls

ISIS inserts disturbing images into N.L. vote Twitter chatter
Note: The CBC does not necessarily endorse any of the views posted. By submitting your comments, you acknowledge that CBC has the right to reproduce, ...

Updates for Google Docs & Slides let you insert & quickly edit images on Android/iOS
Google is today rolling out updates to its Google Docs and Slides mobile apps bringing the ability to insert images directly from the app on ...

Gmail for iOS updated with ‘Insert from Drive’ and ‘Save to Drive’
Google has released an update to Gmail for iOS this afternoon that brings “Insert from Drive” and “Save to Drive” functionality to the iPhone ...

Resources last updated: 2/7/2016 1:37:25 PM