E
Emma
Hi I know this isn't the forum for coding but I'm at a standstill. How do I
copy a photo from one database and put it in another. I've been reading about
getchunks but I'm not sure that's what I need to do. I'm using appendchunk to
store it in the second database and that seems to be working fine. It's just
how do I get the photo out of the first database. Here is my convoluted code,
any help would be appreciated:
'Read in the record number to be inserted
RecordNo3 = CLng(Request.QueryString("ID"))
'Create an ADO connection object
Set Conn3 = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less
connection
Conn3.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("\db\FileDB.mdb")
'Create an ADO recordset object
Set oRS3 = Server.CreateObject("ADODB.Recordset")
'set objField=Server.CreateObject("ADODB.field")
'Initialise the strSQL variable with an SQL statement to query the database
sSQL3 = "SELECT Files.* FROM Files WHERE ID=" & RecordNo3
Set oRS3 = Conn3.Execute(sSQL3)
fileName = oRS3("File Name")
fileSize = oRS3("File Size")
'fileData = oRS3(fileName).GetChunk(fileSize)
'fileData = "/AHousingHelpCentre/LoadPhoto.asp?ID=oRS("ID").Value"
'fileData = objField.GetChunk(size)
contentType = oRS3("Content Type")
copy a photo from one database and put it in another. I've been reading about
getchunks but I'm not sure that's what I need to do. I'm using appendchunk to
store it in the second database and that seems to be working fine. It's just
how do I get the photo out of the first database. Here is my convoluted code,
any help would be appreciated:
'Read in the record number to be inserted
RecordNo3 = CLng(Request.QueryString("ID"))
'Create an ADO connection object
Set Conn3 = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less
connection
Conn3.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("\db\FileDB.mdb")
'Create an ADO recordset object
Set oRS3 = Server.CreateObject("ADODB.Recordset")
'set objField=Server.CreateObject("ADODB.field")
'Initialise the strSQL variable with an SQL statement to query the database
sSQL3 = "SELECT Files.* FROM Files WHERE ID=" & RecordNo3
Set oRS3 = Conn3.Execute(sSQL3)
fileName = oRS3("File Name")
fileSize = oRS3("File Size")
'fileData = oRS3(fileName).GetChunk(fileSize)
'fileData = "/AHousingHelpCentre/LoadPhoto.asp?ID=oRS("ID").Value"
'fileData = objField.GetChunk(size)
contentType = oRS3("Content Type")