upload image in vb.net

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 2
Reputation: venkat554 is an unknown quantity at this point 
Solved Threads: 0
venkat554 venkat554 is offline Offline
Newbie Poster

Re: upload images and store the location in a database

 
0
  #1
Nov 28th, 2008
Originally Posted by quansah View Post
i want to upload files into a folder and store the relative loaction of that file in a database using php and mysql. help
how to upload image in vb.net.i need coding so please somebudy help me.

thank you
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,205
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 486
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: upload image in vb.net

 
0
  #2
Nov 28th, 2008
Post moved to BV.NET section
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: upload image in vb.net

 
0
  #3
Nov 28th, 2008
Dealing with images and databases is basically done with byte arrays.

Here's a one starting point with VB.NET code samples from my blog:
Convert image to byte array and vice versa
Save binary data to SQL Server with VB.NET

You may also try Daniweb's site search. I've answered the same or at least very similar question few times. A pretty good search phrase is "image SQL Server VB.NET" (without quotes).
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 144
Reputation: sierrainfo is an unknown quantity at this point 
Solved Threads: 9
sierrainfo sierrainfo is offline Offline
Junior Poster

Re: upload image in vb.net

 
0
  #4
Dec 3rd, 2008
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 2
Reputation: venkat554 is an unknown quantity at this point 
Solved Threads: 0
venkat554 venkat554 is offline Offline
Newbie Poster

Re: upload images and store the location in a database

 
0
  #5
Dec 4th, 2008
15. Dim connection As New SqlConnection("connection string here")
16. Dim command As New SqlCommand("UPDATE MyTable SET Picture = @Picture WHERE ID = 1", connection)
17.
18. Using picture As Image = Image.FromFile("file path here")
19. Using stream As New IO.MemoryStream
20. picture.Save(stream, Imaging.ImageFormat.Jpeg)
21. command.Parameters.Add("@Picture", SqlDbType.VarBinary).Value = stream.GetBuffer()
22. End Using
23. End Using
24.
25. connection.Open()
26. command.ExecuteNonQuery()
27. connection.Close()
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: upload image in vb.net

 
0
  #6
Dec 4th, 2008
That works. If you have an existing row to update. If you want to insert a new one, the code changes a bit:
  1. 16. Dim command As New SqlCommand("INSERT INTO MyTable (Picture) VALUES (@Picture); SELECT @@IDENTITY AS 'Identity'", connection)
  2. 17. Dim ThisPictureID As Integer
  3. 26. ThisPictureID = CInt(command.ExecuteScalar())
Now ThisPictureID contains new ID.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC