Hi can someone push me in the right direction to learn me how to read a picture from an SQL database in vb.net..i can save the image but i want to read it now and display it. I have searched the web and cant find anything that can help me(i dont really know what to search for or what its called spesifically), just need a good example to show me how to do it and what steps i need to make to read from database an show it in a picture box
thanks in advance
vb.net & sql
Page 1 of 15 Replies - 512 Views - Last Post: 08 October 2012 - 10:12 AM
Replies To: vb.net & sql
#2
Re: vb.net & sql
Posted 08 October 2012 - 08:48 AM
Great example here VB.Net SQL Tutorial. That's where I learned what I needed to know. I've found many SQL tutorials though, so I'm not sure where you could have lacked any search results.
#3
Re: vb.net & sql
Posted 08 October 2012 - 08:51 AM
thanks will look into it now...i also dont know where im lacking still quite new to programming so maybe i dont search for the right stuff
#4
Re: vb.net & sql
Posted 08 October 2012 - 08:53 AM
Ah nope problem just have learn to break down tasks. It's like objects, objects can be made of other objects, so you've got to look at it the same way. Your task is connecting to a sql database, querying for data, and then converting the binary into an image. Three tasks for the best results.
You're definitely going to need to import the System.Data.SqlClient classes.
Here's a list of the things that come off the top of my head, that you'll need to use for the connection, and querying.
-SqlConnection
-SqlCommand
-A String variable for your connection string, or function to return the string
-A String variable for the command string, or function to return the string
-SqlDataAdapter, or SqlDataReader, there are many objects in this field, you can even skip using them
Do not forget to use MSDN if something does not work. I can't think of how many little errors you may get in your process that can be solved by using the MSDN library provided by Microsoft for help.
You're definitely going to need to import the System.Data.SqlClient classes.
Imports System.Data.SqlClient
Here's a list of the things that come off the top of my head, that you'll need to use for the connection, and querying.
-SqlConnection
-SqlCommand
-A String variable for your connection string, or function to return the string
-A String variable for the command string, or function to return the string
-SqlDataAdapter, or SqlDataReader, there are many objects in this field, you can even skip using them
Do not forget to use MSDN if something does not work. I can't think of how many little errors you may get in your process that can be solved by using the MSDN library provided by Microsoft for help.
This post has been edited by trevster344: 08 October 2012 - 08:59 AM
#5
Re: vb.net & sql
Posted 08 October 2012 - 09:23 AM
ok i all ready know how to insert update and delete and i know how to save a picture into the database its stores it in bytes (think hexadecimals), so the picture saves into the database now i want to know how to display that picture in a picture box. I dont think you read it the same way as you do with normal text data.
The link you gave me was very nice way of explaining how to insert normal data and displaying it again but doesn't show anything about a picture can you give me a link on how to read a picture form a database and display it
The link you gave me was very nice way of explaining how to insert normal data and displaying it again but doesn't show anything about a picture can you give me a link on how to read a picture form a database and display it
#6
Re: vb.net & sql
Posted 08 October 2012 - 10:12 AM
You need to take the bytes, and save them into a new file.
system.io.file.writeallbytes
Then you need to retrieve that image and store it into an image object, and set the picturebox image property to the file location of the image.
system.io.file.writeallbytes
Then you need to retrieve that image and store it into an image object, and set the picturebox image property to the file location of the image.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|