Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert and retrieving image on Visual basic 6.0

Author  Topic 

wormz666
Posting Yak Master

110 Posts

Posted - 2009-04-22 : 01:47:15
im having problem with inserting object within MS SQL Server 2000,

i want to insert a picture and retrieve it..

i dont know how to do it?...

thank you in advance

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-04-22 : 14:22:28
Images should never be stored in a database and instead should be stored on the filesystem. However, you can store a "link" to the image in the DB.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-22 : 14:26:52
It makes things harder to backup, having the images on disk.
You have to maintain two backups.

There are uses for having images in the database.

Wormz, there are numerous examples here at SQLTeam or with Google how to do this.
Have a look at the STREAM object that comes with ADO.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2009-04-22 : 14:28:08
and if u want to sotre images in SQL server,,, then it be like this....

Create table like this

CREATE TABLE [dbo].[ImageTest](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Image] [varbinary](max) NULL
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]


and insert images into like that,,,

INSERT INTO [dbo].[ImageTest]([Image])
SELECT * FROM
OPENROWSET(BULK N’D:\images1\image.jpg’, SINGLE_BLOB) AS Document
GO

May be helpful to you,,,,
Thanks...

iF theRe iS a wAy iN tHen theRe iS a wAy oUt..
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-04-22 : 14:31:28
quote:
Originally posted by Peso

It makes things harder to backup, having the images on disk.
You have to maintain two backups.

There are uses for having images in the database.

Wormz, there are numerous examples here at SQLTeam or with Google how to do this.
Have a look at the STREAM object that comes with ADO.



E 12°55'05.63"
N 56°04'39.26"




Lazyness is often the cause of poor performing applications. Senior developers everwhere recommend against storing images in the DB. I'll leave it at that.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-04-22 : 14:31:46
Here are two links that may or may not help:

Scroll way down:
[url]http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20042306.html[/url]
[url]http://www.xtremevbtalk.com/showthread.php?t=169654[/url]
Go to Top of Page

bmiddleton74
Starting Member

5 Posts

Posted - 2009-04-22 : 22:56:46
quote:
Originally posted by wormz666

im having problem with inserting object within MS SQL Server 2000,

i want to insert a picture and retrieve it..

i dont know how to do it?...

thank you in advance






I've done this in quite a few applications, if you are using sql 2000, your best data type will be IMAGE. I can also post some front end code that will put the picture in a memory stream that can be inserted if you wish. I have C#, VB.Net of VB 6.
Go to Top of Page

bmiddleton74
Starting Member

5 Posts

Posted - 2009-04-22 : 22:59:03
quote:
Originally posted by whitefang

quote:
Originally posted by Peso

It makes things harder to backup, having the images on disk.
You have to maintain two backups.

There are uses for having images in the database.

Wormz, there are numerous examples here at SQLTeam or with Google how to do this.
Have a look at the STREAM object that comes with ADO.



E 12°55'05.63"
N 56°04'39.26"




Lazyness is often the cause of poor performing applications. Senior developers everwhere recommend against storing images in the DB. I'll leave it at that.



I'm not Lazy, or a Senior, but I am experienced, and whitefang is correct. I will store a path to a picture in the future.
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2009-04-24 : 07:08:04
thank to you all out here......................

this forums help me a lot......

i gonna try it now..
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-30 : 05:34:48
quote:
Originally posted by whitefang

Lazyness is often the cause of poor performing applications. Senior developers everwhere recommend against storing images in the DB. I'll leave it at that.


The late Jim Gray (reciever of the Turing award) wrote a research paper "To Blob Or Not To Blob" a few years ago
http://research.microsoft.com/apps/pubs/default.aspx?id=64525

Copy found here
http://arxiv.org/ftp/cs/papers/0701/0701168.pdf

The conclusion is that images up to 256 kb in size should be stored in the database and
images larger than 1 mb in size should be stored in the filesystem.

For images of sizes in between 256 kb and 1 mb, the answer varies depending on numerous factors.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -