473,769 Members | 3,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

extract blob from database

I would like to be able to extract a BLOB from the database (SqlServer)
and pass it to a browser without writing it to a file. (The BLOB's
are word doc's, MS project doc's, and Excel spreadsheets.

How can I do this?
Nov 15 '05 #1
3 3812
Hello,

I can help you with the first bit, extracting the blob from the database.

Create a SqlCommand to select it, e.g. "SELECT Blob FROM DataTable WHERE
<some criteria>". Then use ExecuteScalar to retrieve the result and cast it
to a byte array:
byte[] blob = (byte[])cmd.ExecuteSca lar();

But I don't know what you need to do next, sorry. I'm sure somebody else
will know.
"Selen" <sk*****@yahoo. com> wrote in message
news:uE******** ******@TK2MSFTN GP11.phx.gbl...
I would like to be able to extract a BLOB from the database (SqlServer)
and pass it to a browser without writing it to a file. (The BLOB's
are word doc's, MS project doc's, and Excel spreadsheets.

How can I do this?

Nov 15 '05 #2
Response.Clear( );
Response.AddHea der( "content-disposition", "attachment ;
filename=\"Stuf f.doc\"");
Response.Conten tType = "applicatio n/msword";
// (or whatever the appropriate MIIME type)
Response.Binary Write( blob); // your byte array

// above is untested but you get the idea...
Your choices are "inline" or "attachment ". If you choose "inline" then the
response
may be displayed in the browser if it so chooses
depending on the setting of the ContentType. If you choose "attachment " the
user will
always be prompted to save or open.

"Selen" <sk*****@yahoo. com> wrote in message
news:uE******** ******@TK2MSFTN GP11.phx.gbl...
I would like to be able to extract a BLOB from the database (SqlServer)
and pass it to a browser without writing it to a file. (The BLOB's
are word doc's, MS project doc's, and Excel spreadsheets.

How can I do this?

Nov 15 '05 #3
Response.Clear( );
Response.AddHea der( "content-disposition", "attachment ;
filename=\"Stuf f.doc\"");
Response.Conten tType = "applicatio n/msword";
// (or whatever the appropriate MIIME type)
Response.Binary Write( blob); // your byte array

// above is untested but you get the idea...
Your choices are "inline" or "attachment ". If you choose "inline" then the
response
may be displayed in the browser if it so chooses
depending on the setting of the ContentType. If you choose "attachment " the
user will
always be prompted to save or open.

"Selen" <sk*****@yahoo. com> wrote in message
news:uE******** ******@TK2MSFTN GP11.phx.gbl...
I would like to be able to extract a BLOB from the database (SqlServer)
and pass it to a browser without writing it to a file. (The BLOB's
are word doc's, MS project doc's, and Excel spreadsheets.

How can I do this?

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7100
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and disadvantages of using a MySQL blob field rather than reading the images directly from the file? How does one insert an image into a blob field? Can it be done dynamically? Thank you John
5
2680
by: Bob Kaku | last post by:
I've created a MySQL database to store a large amount of text. Since the text data type in MySQL is limited to 255 characters, I added a BLOB column. I created an PHP input screen to enter the large text. It seems to work. But, I cannot verify the entry, because the standard select SQL does not display the contents. I want to retrieve the contents from the database and display on a web page. The retrieval seems to occur. But, I...
6
5706
by: Juergen Gerner | last post by:
Hello Python fans, I'm trying and searching for many days for an acceptable solution... without success. I want to store files in a database using BLOB fields. The database table has an ID field (INT, auto_increment), an ORDER field (INT, for knowing the right order) and a "normal" BLOB field. It is planned to split large files in 64k-parts and sort these parts by the ORDER field. Here's some pseudo code how I wanted to implement this...
0
2275
by: REM | last post by:
I have some problems. It's dilemma between BLOB, BFILE and takes care of file on file system. What it's advantage?? I import some PDF document in BLOB filed in my database. It's about 1000 documents on day. My first question is: if I have a PDF on file system about 100 kb and if I import this in BLOB field in database. How much it's take more recourse.
3
4726
by: hamvil79 | last post by:
I'm implementig a java web application using MySQL as database. The main function of the application is basically to redistribuite documents. Those documents (PDF, DOC with an average size around 2Mb) are stored in BLOB column. The amount of documents for the first year should not exceed 5/6 Giga, but I cannot make prevision for the next years. Those documents are mainly just accessed (update and delete are not so
9
378
by: Hrvoje Voda | last post by:
I wrote this code to save a blob data into database. What is wrong? public ArrayList SetProfile(byte Profile) { ArrayList arrayProfile = new ArrayList ();
6
2224
by: Selen | last post by:
I would like to be able to extract a BLOB from the database (SqlServer) and pass it to a browser without writing it to a file. (The BLOB's are word doc's, MS project doc's, and Excel spreadsheets. How can I do this?
10
5238
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What datatypes a have to use ??? Thanks
2
6534
by: Vinciz | last post by:
hi guys... im new in java and i would love to learn some of these... basically i got a sample code to retrieve the blob from the mysql. however, i dont really know what to do with these retrieved byte/binary data as i got no idea on how to save them in our pc. For this situation, what i need to do is give the byte/binary data an extension (retrieved from another field in the table) in order to revert back to the original data i had in the...
0
9579
marktang
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...
0
9420
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,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
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...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
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
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.