Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2004, 02:42 PM
Registered User
 
Join Date: Feb 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Image in a data access page.

I need to find out the best way to have an image come up in a data access page . I have the information in a sql database but I'm trying to create the data page in access. What im working with is a access database with a persons name, address, and other personal information along with a picture of that person. But when i create the data page i cant add the image to that file. Its says that there isnt a html control. I need to find out how to make the control and implement it. Any help is greatly appriciated.

 
Old February 25th, 2004, 05:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To be honest, the best option would probably be to use something other than Access (eg: Dreamweaver - which makes adding images from a datasource easy).
Access is possibly the worst tool to use when designing dynamic pages.

Probably not the answer you were after - but it's the best I can do pre-coffee

I am a loud man with a very large hat. This means I am in charge
 
Old February 26th, 2004, 02:03 PM
Registered User
 
Join Date: Feb 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need to be able to do a search from the SQL database and have it come up on the page. all of the information and the picture associated with the information.

 
Old February 26th, 2004, 07:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Since this is a Wrox site, I guess I should probably plug one of their books which is pretty good:
http://www.wrox.com/books/0764543636.shtml

Having done that, there's about a billion resources on the web of how to do what you're after using ASP. For example:

http://www.dwfaq.com/Tutorials/Ultra...s_from_db1.asp

HTH

Steven

I am a loud man with a very large hat. This means I am in charge
 
Old February 27th, 2004, 05:13 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well that's the trouble with having pictures actually in the database, if you just stored the path to the image you could then create an IMG tag dynamically with the SRC attribute set to the image's path. If you actually have the binary data stored in the field you hace two choices
1) To show just the image on a page extract the binary data and set the page type to 'image/jpeg' or whatever format you have and response.binaryWrite the data to the page. This means that the image is the only thing on the page though.
2) Extract the data and save it to the server's hard disk with a temporary name and then create an IMG tag pointing at the new image. Periodically clear out this folfer.



--

Joe
 
Old March 1st, 2004, 03:41 PM
Registered User
 
Join Date: Feb 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok im trying to pull the image from the pubs database that is a default database in SQL. Im using this http://support.microsoft.com/default...b;en-us;173308
as a guide. Im now getting this error.


Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Ive tried to figure out what this means and i think i have an idea what its for but im not sure what the correct syntax would/will be.


 
Old March 1st, 2004, 09:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to define your DSN/connection properly.
For example:
Code:
<%
dim sdsn
dim Conn
sdsn="DBQ=" & Server.Mappath("SomeDB.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open sdsn
%>
Of course, that's using an DSNless connection to an Access database, which you're not using.

So I'll revise that code:
If you have a DSN, then use something like:
Code:
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=myCONNECTION.dsn"
objConn.Open

DIM mySQL
mySQL = "SELECT * FROM myTABLE"

DIM objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn
%>
Or - assuming you don't have a DSN, something along the lines of:
Code:
<% 
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath="DRIVER={SQLServer};SERVER=TheServer;UID=TheUser;PWD=ThePassword;DATABASE=TheDatabase"
Conn.open FilePath
%>

I am a loud man with a very large hat. This means I am in charge
 
Old March 2nd, 2004, 12:17 AM
Registered User
 
Join Date: Feb 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I really appriciate the help steven. I will give that a shot in the next day or two and I'll let you know if its the ticket. Im totally new to this and really want to understand what it all is also. I know that you have to make the connection , but the required method was the problem. I think i understand a little bit more. Thanks again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access: Data Access Page sevp95 Access VBA 0 July 14th, 2008 11:07 AM
access data from another page rocksbhavesh ASP.NET 1.0 and 1.1 Professional 5 March 26th, 2007 08:18 AM
Data access page Fntmn Javascript How-To 1 March 21st, 2006 07:15 AM
Data Access Page Teqlump Access 9 November 1st, 2004 11:36 PM
Data access page access problem :) kev_79 Access 0 September 4th, 2003 04:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.