Dear sir
I m Software Engineer in Software co.
My question is how do i Store OLE Object (JPG) file to database
AppendChunk
plz Help me
7 12549
Pass the OLE Picture Object and the ADO Database field to the following code. It's not pretty since it uses an intermediate Windows File, but it is the shortest piece of code I know. There are other methods using In Memory files, etc.
To be honest I use the LEAD Tools Image Object that has a SAVE command.
Neon K. -
-
Public Sub WriteImage(ByRef pPict As StdPicture, ByRef pField As ADODB.Field)
-
-
On Error Resume Next
-
-
Dim strStream As New ADODB.Stream
-
-
strStream.Type = adTypeBinary
-
strStream.Open
-
Call SavePicture(pPict, "TempTemp.bmp")
-
strStream.LoadFromFile ("TempTemp.bmp")
-
pField.Value = strStream.Read
-
Kill "TempTemp.bmp"
-
strStream.Close
-
-
End Sub
-
Hi there,
below are some sample to store and to retrieve images from and to BLOB field.. give it a try..
retrieve from BLOB field -
Public Sub getBLOB(RS As ADODB.Recordset, Field As String, Des As String)
-
Dim lngFieldSize As Long
-
Dim fileBytes() As Byte
-
Dim intFileHandle As Integer
-
-
intFileHandle = FreeFile
-
-
lngFieldSize = RS(Field).ActualSize
-
If lngFieldSize > 0 Then
-
fileBytes = RS(Field).GetChunk(lngFieldSize)
-
Open Des For Binary As intFileHandle
-
Put intFileHandle, , fileBytes
-
Close intFileHandle
-
End If
-
End Sub
-
store to BLOB field -
Public Sub setBLOB(RS As ADODB.Recordset, Field As String, Source As String)
-
Dim fileBytes() As Byte
-
Dim intFileHandle As Integer
-
-
intFileHandle = FreeFile
-
-
Open Source For Binary As intFileHandle
-
fileBytes = InputB(LOF(intFileHandle) - 1, intFileHandle)
-
RS(Field).AppendChunk fileBytes
-
Close intFileHandle
-
End Sub
-
sample usage -
setBLOB myRecordSet, "FileField", "c:\myfile.gif" ' Places file into database
-
-
getBLOB myRecordSet, "FileField", "c:\myfile_extracted_from_database.gif"
-
good luck my fren.. :)
Hi there,
below are some sample to store and to retrieve images from and to BLOB field.. give it a try..
retrieve from BLOB field -
Public Sub getBLOB(RS As ADODB.Recordset, Field As String, Des As String)
-
Dim lngFieldSize As Long
-
Dim fileBytes() As Byte
-
Dim intFileHandle As Integer
-
-
intFileHandle = FreeFile
-
-
lngFieldSize = RS(Field).ActualSize
-
If lngFieldSize > 0 Then
-
fileBytes = RS(Field).GetChunk(lngFieldSize)
-
Open Des For Binary As intFileHandle
-
Put intFileHandle, , fileBytes
-
Close intFileHandle
-
End If
-
End Sub
-
store to BLOB field -
Public Sub setBLOB(RS As ADODB.Recordset, Field As String, Source As String)
-
Dim fileBytes() As Byte
-
Dim intFileHandle As Integer
-
-
intFileHandle = FreeFile
-
-
Open Source For Binary As intFileHandle
-
fileBytes = InputB(LOF(intFileHandle) - 1, intFileHandle)
-
RS(Field).AppendChunk fileBytes
-
Close intFileHandle
-
End Sub
-
sample usage -
setBLOB myRecordSet, "FileField", "c:\myfile.gif" ' Places file into database
-
-
getBLOB myRecordSet, "FileField", "c:\myfile_extracted_from_database.gif"
-
good luck my fren.. :)
Is there any other method to do this?
because after using this code it stores image as Long binary data. If you do the same With using MsAccess's form, it stores as Bitmap file. If we are handling Big database, then above example will make any differance to speed of accessing database?
Plz reply waiting
Hi there,
Another option will be converting BMP to JPG format respectively, take a look at below attached link, hope it helps. Good luck & take care. http://www.vbaccelerator.com/home/VB...ry/article.asp
Is there any other method to do this?
because after using this code it stores image as Long binary data. If you do the same With using MsAccess's form, it stores as Bitmap file. If we are handling Big database, then above example will make any differance to speed of accessing database?
Plz reply waiting
im also looking and still in progress of implementation "How do i store OLE Object (JPG) file to database( MS-ACCESS and SQL SERVEr2000) for my recent project..as soon as i will provide whole source code.in .ZIP format
take care
from geoamins.uni.cc
hi co-scrpiters
would you send me a running visual basic code for uploading and retrieving images from mysql database?
here is my email address mil id removed
please....
because i tried so many codes that i have seen over the net but none of them will run... i think there something maybe on my code that i have to refresh..
please send it to me... it will be very much appreciated...
thnx all and god bless us all scripters...
ikebiz...
Please find related discussions here and here .
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lars Behrens |
last post by:
Hi there!
For a web project I need a little expert help. I don't have written much
code yet, just been fiddling around a bit, testing and planning.
The web site will have a submission page for...
|
by: David Stockwell |
last post by:
Hi,
I'd like to read the contents of a file into memory. The problem is that
this file is binary. I then want to store the whole thing in memory to a
database as a blob.
I have no problem...
|
by: Karen Grube |
last post by:
Hi!
Each week, we receive a two-page PDF file from UPS along with a separate
flat file (a CSV) The PDF file contains the overview of our weekly invoice
and the CSV contains the details of each...
|
by: DL |
last post by:
Hi,
Many questions have already been asked and answered about images in
Access... But despite having searched, I have not found an answer to
the following question...
In my DB, several forms...
|
by: nigel.thomson |
last post by:
Hello All
Is there an easy way to do this?
I have a database that contains records witha image as one of the
fields, what I want to do is export the images to a seperate folder, in
whatever...
|
by: Paul Cheetham |
last post by:
Hi,
I am developing an application that needs to store some machine-specific
settings. The application is going to be published on the network in
order to keep the clients on the latest version....
|
by: JM |
last post by:
Before storing information from a form in database I perform follwing
operations on it :
$path =
mysql_real_escape_string(strip_tags(trim(urldecode($_POST))));
$summary =...
|
by: harshad |
last post by:
Dear All,Here I am facing problem to store image.I am trying to store byte
array(image) in to session variable so at time of update I will got that
byte array and I do my update. here i am given...
|
by: gm000 |
last post by:
hi
i m using radiobuttonlist with images like this
<asp:RadioButtonList ID="rbtnthumb1" runat="server">
<asp:ListItem Value ="News_icon.jpg">
<img...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |