Please This is queit a task av been trying to solve. Could anyone please tell
me how to read a blob from an SQL using a dataset and stuffing this image
into the Image control of a webform.
Any suggetion that would help would be highly appreciated.
--
Iyke 9 1846
This is an example of the Page_Load event of a page GetImage.aspx:
protected void Page_Load(objec t sender, System.EventArg s e)
{
// get image id
string imageId = this.Request.Pa rams["id"];
System.Data.Sql Types.SqlBinary image; // image from database
string sql = String.Format ("SELECT photo FROM customers WHERE
customer_id = {0}", imageId);
// get image from database
SqlConnection conn = new SqlConnection (myConnectionSt ring);
SqlCommand com = new qlCommand (sql, conn);
conn.Open();
try
{
SqlDataReader reader = dba.RunSelect (sql);
reader.Read ();
image = reader.GetSqlBi nary(0);
reader.Close ();
}
finally
{
conn.Close ();
}
if (!image.IsNull && image.Value.Len gth != 0)
{
// stream image down to client
this.Response.C ontentType = "image/gif";
this.Response.B inaryWrite (image.Value);
}
}
You would use this page as an url for your image control in format
"GetImage.aspx? id=xx".
Eliyahu
"JuniorProgramm er" <tr****@discuss ions.microsoft. com> wrote in message
news:A9******** *************** ***********@mic rosoft.com... Please This is queit a task av been trying to solve. Could anyone please tell me how to read a blob from an SQL using a dataset and stuffing this image into the Image control of a webform. Any suggetion that would help would be highly appreciated. -- Iyke
On Sun, 19 Mar 2006 02:39:13 -0800, JuniorProgramme r wrote: Any suggetion that would help would be highly appreciated.
I suggest NOT using the database to store images, unless they're fairly
small ones. Instead, store the image on the disk, and store a filename
pointer to it in the database. This will make your database smaller, less
prone to fragmentation, and reduce the bandwidth being consumed by record
requests.
In my opinion, storing images in databases takes far more resources than
storing them in the file system.
Often, security considerations make using database mandatory.
Eliyahu
"Erik Funkenbusch" <er**@despam-funkenbusch.com > wrote in message
news:6t******** *******@funkenb usch.com... On Sun, 19 Mar 2006 02:39:13 -0800, JuniorProgramme r wrote:
Any suggetion that would help would be highly appreciated.
I suggest NOT using the database to store images, unless they're fairly small ones. Instead, store the image on the disk, and store a filename pointer to it in the database. This will make your database smaller, less prone to fragmentation, and reduce the bandwidth being consumed by record requests.
In my opinion, storing images in databases takes far more resources than storing them in the file system.
On Sun, 19 Mar 2006 17:21:11 +0200, Eliyahu Goldin wrote: Often, security considerations make using database mandatory.
That doesn't make any sense. Any security consideration you can put in
place via SQL can be put in place using file permissions.
In SQL Server you can setup security rights for sql logons and roles. File
permissions can be granted to windows accounts, not to sql ones.
Eliyahu
"Erik Funkenbusch" <er**@despam-funkenbusch.com > wrote in message
news:f8******** *******@funkenb usch.com... On Sun, 19 Mar 2006 17:21:11 +0200, Eliyahu Goldin wrote:
Often, security considerations make using database mandatory.
That doesn't make any sense. Any security consideration you can put in place via SQL can be put in place using file permissions.
On Sun, 19 Mar 2006 18:05:20 +0200, Eliyahu Goldin wrote: In SQL Server you can setup security rights for sql logons and roles. File permissions can be granted to windows accounts, not to sql ones.
Windows also has security rights and roles. Again, anything you can define
in SQL can be defined in Windows as well. If you're stuck on using SQL for
your security, it's pathetically easy to validate security through SQL to
access files on the hard disk.
Security is not a valid reason in my opinion.
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote: Often, security considerations make using database mandatory.
Well, even more often the database could be accessed across domains, and
through different applications (or application layers) that does not allow
the use of a std. filesystem access.
- in that case the Database seems the more flexible choice.
R-)
Security considerations notwithstanding ,
here is an alternative method for reading and displaying images as you
describe without the need for an external handler (e.g., get them directly
out of the same DataSet your other data is in): http://www.eggheadcafe.com/articles/20050911.asp
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"JuniorProgramm er" wrote: Please This is queit a task av been trying to solve. Could anyone please tell me how to read a blob from an SQL using a dataset and stuffing this image into the Image control of a webform. Any suggetion that would help would be highly appreciated. -- Iyke
I want to thank you all for ur replies. Every contribution made good sence,
even broadens my idea of the issue.
Thank you very much one and all. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: omkar prabhu |
last post by:
i am using postgres 7.0.3
and also postgres 7.2.1
I am new towards using blobs,I want to transfers
records with blobs from a table to different
database(postgres) using
perl without extracting the blob to disk(i.e without
using lo_export/lo_import).
Below is my perl script which is not working can
|
by: dale zhang |
last post by:
Hi,
I am trying to read an image from MS Access DB based on the following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
The article author is using PictureBox for windows application, while I am
doing for web. I can only find Image from web forms control and HTML control.
This may be the root cause of my problem. For read button, I converted his VB
to the C#. But the compiler complains:
|
by: mb345345 |
last post by:
Hi group, I have a nice little CMS application which has been running
for quite some time storing content in blobs in sql (the 'image'
datatype) and spitting them out to a frame in the browser via a page
called showContent.aspx:
Response.ContentType = strContentType
Response.BinaryWrite(objFileObject)
However, Excel seems to display some rather odd behaviour:
|
by: Ed |
last post by:
Hope someone can help me out...
I have been tasked to read some image data from an sql database and
save the files to flat files. OK, sounds easy as I'v used BLOBs
before. But this is an old database and I cannot get the image to
work.
The columns in the database are of type text. Here is one of the
images text (in full) in the database (I hope you can see it):
|
by: Connie |
last post by:
We have a blob in one table that is storing pdf files. I need to
write a select query that will grab that column and write those *.pdf
files out to a location on my hard drive. Does anyone know how that
can be done? All suggestions would be greatly appreciated....
| |
by: sylwiq |
last post by:
I am using DB2 and it's Image Extender to query database by image content.
When using Tomcat and jsp (JDBC driver) everything works, but when using PHP and Apache - queries by content do not work.
I know that the Apache and ODBC driver should be specially configured to support BLOBs, however I have no idea how.
Please help ASAP.
|
by: bhodgins |
last post by:
Hi,
I am new on here, and had a newbie question that I am stumped with.
I am not new to access, but am new to VB.
I am trying to export BLOBs from a field called photo to external jpeg files. I have tried the MS kb 210486 and successfully got the import/export to work with a sample table, but only the first record. I do not wish to impost binary data to the database, it's already there. I simply wish to pick up the binary BLOB from the photo...
|
by: kentgorrell |
last post by:
I had a wonderful time working out how to read and write BLOBs using GetChunk until I found the new streaming object in ADO 2.6 very easy.
Now I am confronted with DIBs
The code I have is VB6 but only partial so I can't actually run it. Anyhow I need to get it to work in Access but there are a couple of properties and methods of the picture control in VB6 that don't have corresponding ones in Access. Like TwipsPerPixel which I can just...
|
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= |
last post by:
Hi all another LINQ question!!
to retrieve and display sql varbinary images I currently use the following
code:
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |