473,809 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I wan't your help in Inserting and selecting image from DB



Hello Every One ,
I need Help in inserting the user image in my data base. but
unfortunatly I don't know how.I'm using asp with sql server. I tried to
insert the image and i geuss it worked.for the field in the db in not
null and it have this value <Binary> . but when i try to select it in
gives me this error "An unhandled data type was encountered".
this is my code :

To insert the image
sql="insert into users_img (user_image,use r_id) values
('"&image&"','" &userid&"')"
set rs=conn.Execute (sql)

to Select the image :
sql="select * from users_img where user_id='"&user id&"'"
set rs=conn.Execute (sql)
Response.Conten tType = "image/jpg"
Response.Binary Write rs("adv_image" )

Realy Need Your help
thanx alot
Yours, Maii Ali
*** Sent via Developersdex http://www.developersdex.com ***
May 1 '06 #1
1 1710
developers wrote:
I need Help in inserting the user image in my data base. but
unfortunatly I don't know how.I'm using asp with sql server. I tried
to insert the image and i geuss it worked.for the field in the db in
not null and it have this value <Binary> . but when i try to select
it in gives me this error "An unhandled data type was encountered".
this is my code :

To insert the image
sql="insert into users_img (user_image,use r_id) values
('"&image&"','" &userid&"')"
set rs=conn.Execute (sql)
I don't think you can insert the image as text. This is almost certainly
your problem.
to Select the image :
sql="select * from users_img where user_id='"&user id&"'"
set rs=conn.Execute (sql)
Response.Conten tType = "image/jpg"
Response.Binary Write rs("adv_image" )


1. If you are only going to use [adv_image], why select[*] ?
2. Test for existence.
3. Default properties hurt my eyes. Get in the habit of using explicitly
named ones.
4. When your browser *uploads* JPG images, it sends "image/jpeg", not
"image/jpg", so you should send it back the same way.

Set rs = conn.Execute(sq l)
If NOT rs.EOF Then
Response.Conten tType = "image/jpeg"
Response.Binary Write(rs.Fields ("adv_image").V alue
Else
Response.Redire ct("NotFound.jp g")
End If

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
May 1 '06 #2

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

Similar topics

2
4311
by: Erich93063 | last post by:
I have made the following test stored proc that all it does right now is accept a string variable that will be a list ie. :5,9,6,13. Right now all the SP is doing is creating a temp table to store the values in the list, then looping through the list and inserting the values into the temp table, then selecting all the records from teh temp table. It's WORKING however i must have done something wrong because it's not inserting ALL the...
1
577
by: g_chime | last post by:
How can I make MySQL reject duplicate rows when inserting? The table is quite large: 100+ rows and millions of rows. MySQL doesn't allow me to create a UNIQUE INDEX for all the rows (16 rows is the max.) The brute force method (selecting the new row and inserting only when not found) is way too slow.
1
3109
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a table that has a foreign key constraint that is linked to a lookup table. E.g. Take the following database structure: SQL-Server Database: Table 1:
18
5988
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query against a different table (that uses the LIKE predicate) but cannot get around the SQL0132 error . I have tried the hex notation after the LIKE such as (without the quotes)... " where colNewPartNum like ( X'27' || nnn.colPartNum || X'27) " ,...
3
1305
by: Larry | last post by:
I've set up a list of image filesnames in a listview control(lvSrcFileList), I'm using the selectedIndexChange event to select which file is being displayed in a picturebox control(pbImagePreview). The first time a filename is selected it works fine but if I try to select another filename the program bombs with an exception error; flagging the line below "curntImage = Image.FromFile(cpath). The listview is set for a single selection....
2
1792
by: neuneudr | last post by:
Hi all, I've been trying JavaScript a little bit. I beginned by changing an image using a very simple: document.getElementById(...).src="new image" Which worked fine. However this does not work if Firefox is configured with
8
2389
by: Lee | last post by:
Hi all, I'm trying to programatically change the background color of lines of text and running into a few difficulties, anyone got any suggestions? my relevant code is as follows: public void colorLines() { //_Paint = false; //don't want to update while we are doing this //loop thru lines like addText() does
5
1536
by: Rhishabh07 | last post by:
wan to show more than one hyperlinks on an image. i don wan to use <a href=""> <img src=""> </a>
2
2780
by: sdanda | last post by:
Hi , Do you have any idea how to improve my java class performance while selecting and inserting data into DB using JDBC Connectivity ......... This has to work for more than 8,00,000 of records ..... Can you give some performance tips if you have known 1) For this I am using oci driver ( because I m using oracle 10g) instead of thin driver 2) In that programme I m using prepared statement instead of statement 3) I am...
0
9721
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
9602
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,...
1
10383
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
9200
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...
1
7661
isladogs
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...
0
6881
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();...
0
5550
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...
1
4332
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
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.