5 Replies - 1364 Views - Last Post: 08 October 2012 - 10:12 AM Rate Topic: -----

#1 tieties  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-October 12

vb.net & sql

Posted 08 October 2012 - 08:32 AM

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

Is This A Good Question/Topic? 0
  • +

Replies To: vb.net & sql

#2 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

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.
Was This Post Helpful? 0
  • +
  • -

#3 tieties  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-October 12

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
Was This Post Helpful? 0
  • +
  • -

#4 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

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.
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

Was This Post Helpful? 0
  • +
  • -

#5 tieties  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-October 12

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
Was This Post Helpful? 0
  • +
  • -

#6 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1