|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using images in a database
<i><b>Originally posted by : Tim Brewin (tbrewin@hotmail.com)</b></i><br /><br />Hello,<br /><br />I am developing an ASP driven application as part of a university project. The site is basically a gallery to display photos for various artists. There is a database that store details such as names and addresses and the like and also the actual images that make up the exhibitions. I have made the basic site navigation using Dreamweaver and thats fine. I am now working on the ASP side of things. I'm using Drumbeat to do the design for this which seems to work fine despite being a bit old. The database is built in Access 2000.<br /><br />I can get the basic text information in and out of the database which is OK but am having problems displaying the images and letting people add new images to the database. I'm sure this is just a simple thing but I would appreciate any help anyone has to offer me. Especially anyone who has experience with drumbeat.<br /><br />Thanks in advance,<br /><br />Tim
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Peter (peter_crabb@ntlworld.com)</b></i><br />Hi,<br /><br />I have the same issue. I can obtain the binary data in the feil but this does not just include the jpg. The binary data is wrapped as a OLE Object.<br /><br />Have you managed to solve the problem?<br /><br />If this a help, this is how I got the binay data out (below sorry about the formatting)<br /><br />Pete<br /><br /><br />//imports and stuff<br />void Page_Load()<br />{<br /> string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";<br /> strConnection += @"Data Source= " + Server.MapPath("..\db\images.mdb");<br /> <br /> string strSQL = "SELECT PicKey, Picture FROM Images WHERE PicKey=1";<br /><br /> OleDbConnection objConnection = new OleDbConnection(strConnection);<br /> OleDbCommand objCommand = new OleDbCommand(strSQL, objConnection);<br /> OleDbDataReader objDataReader = null;<br /> <br /> try<br /> {<br /> objConnection.Open();<br /> objDataReader = objCommand.ExecuteReader();<br /> <br /> while(objDataReader.Read())<br /> {<br /> con_close.Text = "the data type = " + objDataReader.GetDataTypeName(0);<br /> //Response.BinaryWrite((byte[]) objDataReader["Picture"] );<br /> }<br /> <br /> objDataReader.Close();<br /> objConnection.Close();<br /> }<br /> catch (Exception e)<br /> {<br /> //TO DO: Suggest the a black small image with exeption is generated<br /> }<br />}<br /></script><br /><html><br /> <body><br /> <h4><br /> Reading data from the connection<br /> </h4><br /> <asp:label id="con_close" runat="server" /><br /> <br><br /> </body><br /></html><br /><br /><br />Hello,<br /><br />I am developing an ASP driven application as part of a university project. The site is basically a gallery to display photos for various artists. There is a database that store details such as names and addresses and the like and also the actual images that make up the exhibitions. I have made the basic site navigation using Dreamweaver and thats fine. I am now working on the ASP side of things. I'm using Drumbeat to do the design for this which seems to work fine despite being a bit old. The database is built in Access 2000.<br /><br />I can get the basic text information in and out of the database which is OK but am having problems displaying the images and letting people add new images to the database. I'm sure this is just a simple thing but I would appreciate any help anyone has to offer me. Especially anyone who has experience with drumbeat.<br /><br />Thanks in advance,<br /><br />Tim
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : sreedhar (balerao_s@yahoo.com)</b></i><br />Hi,<br /><br />I would sujjest keeping all the images in a different relative directory and access images using the relative path, stored in the database.<br /><br />you can easily add images to the directory and adding a relative path in the database.<br /><br />Hope this solves your problem.<br /><br />------------<br />Peter at 4/4/2002 4:54:03 AM<br /><br />Hi,<br /><br />I have the same issue. I can obtain the binary data in the feil but this does not just include the jpg. The binary data is wrapped as a OLE Object.<br /><br />Have you managed to solve the problem?<br /><br />If this a help, this is how I got the binay data out (below sorry about the formatting)<br /><br />Pete<br /><br /><br />//imports and stuff<br />void Page_Load()<br />{<br /> string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";<br /> strConnection += @"Data Source= " + Server.MapPath("..\db\images.mdb");<br /> <br /> string strSQL = "SELECT PicKey, Picture FROM Images WHERE PicKey=1";<br /><br /> OleDbConnection objConnection = new OleDbConnection(strConnection);<br /> OleDbCommand objCommand = new OleDbCommand(strSQL, objConnection);<br /> OleDbDataReader objDataReader = null;<br /> <br /> try<br /> {<br /> objConnection.Open();<br /> objDataReader = objCommand.ExecuteReader();<br /> <br /> while(objDataReader.Read())<br /> {<br /> con_close.Text = "the data type = " + objDataReader.GetDataTypeName(0);<br /> //Response.BinaryWrite((byte[]) objDataReader["Picture"] );<br /> }<br /> <br /> objDataReader.Close();<br /> objConnection.Close();<br /> }<br /> catch (Exception e)<br /> {<br /> //TO DO: Suggest the a black small image with exeption is generated<br /> }<br />}<br /></script><br /><html><br /> <body><br /> <h4><br /> Reading data from the connection<br /> </h4><br /> <asp:label id="con_close" runat="server" /><br /> <br><br /> </body><br /></html><br /><br /><br />Hello,<br /><br />I am developing an ASP driven application as part of a university project. The site is basically a gallery to display photos for various artists. There is a database that store details such as names and addresses and the like and also the actual images that make up the exhibitions. I have made the basic site navigation using Dreamweaver and thats fine. I am now working on the ASP side of things. I'm using Drumbeat to do the design for this which seems to work fine despite being a bit old. The database is built in Access 2000.<br /><br />I can get the basic text information in and out of the database which is OK but am having problems displaying the images and letting people add new images to the database. I'm sure this is just a simple thing but I would appreciate any help anyone has to offer me. Especially anyone who has experience with drumbeat.<br /><br />Thanks in advance,<br /><br />Tim
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Using images in a database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|