Friday, March 23, 2012

Image save into folder

Dear Professional,
Image saved in the table and I wanna copy that image into any folder let's
say... D:\Image\MineImage.gif
Is it possible ?
Thanks
Hi
You will have to write some VB or c# code to do that. SQL Server has no
native support to write out a BLOB filed to a file.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Roy" <roy@.hotmail.com> wrote in message
news:OnuaCw3cFHA.3932@.TK2MSFTNGP12.phx.gbl...
> Dear Professional,
> Image saved in the table and I wanna copy that image into any folder let's
> say... D:\Image\MineImage.gif
> Is it possible ?
> Thanks
>
>
>
>
|||Okie I am ready to write code in VB... any website is available where I can
find that sort of help.
Thanks
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:O0KTG33cFHA.1036@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> Hi
> You will have to write some VB or c# code to do that. SQL Server has no
> native support to write out a BLOB filed to a file.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Roy" <roy@.hotmail.com> wrote in message
> news:OnuaCw3cFHA.3932@.TK2MSFTNGP12.phx.gbl...
let's
>
|||http://support.microsoft.com/default...b;en-us;194975
http://support.microsoft.com/kb/308042/EN-US/
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Roy" <roy@.hotmail.com> wrote in message
news:uj$FjV4cFHA.2124@.TK2MSFTNGP14.phx.gbl...
> Okie I am ready to write code in VB... any website is available where I
> can
> find that sort of help.
> Thanks
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:O0KTG33cFHA.1036@.tk2msftngp13.phx.gbl...
> let's
>
|||Roy wrote:
> Okie I am ready to write code in VB... any website is available where
> I can find that sort of help.
>
I prefer a book for this. For Vb.Net 2003, I'd recommend "Programming
Microsoft Visual Basic.Net 2003," by Francesco Balena (Microsoft Press).
You're about to get into some very large topics: The .Net 1.1 framework,
Windows Forms, and ADO.Net.
Also, check out http://www.devx.com/
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||here is the simple example for saving images into disk
'=================================
Dim rst As New ADODB.Recordset
Dim Image1() As Byte
Dim ms As New ADODB.Stream
Dim cmd As New ADODB.Command
Dim l As Long
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "proc_getImage" '==== poc_code_look_below
cmd.ActiveConnection = CurrentProject.Connection
cmd.Parameters("@.ID") = ID
Set rst = cmd.Execute
ms.Type = adTypeBinary
ms.Open
l = rst(0).ActualSize
Image1() = rst(0).GetChunk(l + 1)
rst.Close
ms.Write (Image1())
deletefile ("c:\img.jpg")
ms.SaveToFile "c:\img.jpg", adSaveCreateOverWrite
ms.Close
Set cmd = Nothing
Set rst = Nothing
Set ms = Nothing
'================================
create PROCEDURE proc_GetImage
(@.ID int)
AS
BEGIN
SELECT photo
FROM tbl_images
WHERE ([ID] = @.ID)
END
'========================
it is just an example, so it is up to you

No comments:

Post a Comment