Salve a tutti, ho un database ACCESS 2013 che interrogo da una pagina ASP. la mia stringa di connessione è:
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= \\isocompserver\asp\DB_production.mdb; Persist Security Info=False;")
sql = "SELECT * FROM Strumenti WHERE Strumenti.Categoria ='Strumenti Elettronici' ORDER BY Marca"
Set RsMacchina = Server.CreateObject("ADODB.Recordset")
RsMacchina.Open sql, conn ,3,3Sfoglio la tabella che mi interessa fino ad arrivare al Record che cerco :
<% do while not RsMacchina.eof .... %>
e Mando in visualizzazione il campo che mi interessa in html :
<% response.write RsMacchina.fields("Ubicazione")%> ecc ...
uno di questi campi del record e un campo Attachment e vorrei scaricare l'attach, che è una foto per mostrarla sulla pagina. non ci riesco neanche a salvarla sul disco. in realtà ho trovato questo codice all'indirizzo : msdn.microsoft.com/en-us/library/office/ff191852.aspx
' Instantiate the child recordset.
Set rsPictures = rsEmployees.Fields("Pictures").Value' Loop through the attachments.
While Not rsPictures.EOF ' Save current attachment to disk in the "My Documents" folder. rsPictures.Fields("FileData").SaveToFile _ "C:\Documents and Settings\Username\My Documents" rsPictures.MoveNext
Wendl'ho modificato secondo per la mia pagina :
' Instantiate the child recordset.
Set rsPictures = RsMacchina.Fields("Foto").Value' Loop through the attachments.
While Not rsPictures.EOF ' Save current attachment to disk in the "My Documents" folder. rsPictures.Fields("FileData").SaveToFile _ "C:\Documents and Settings\Username\My Documents" rsPictures.MoveNext
Wendma come primo e insormontabile errore mi dice :
ErrorCode: 800a01a8 Description: Necessario oggetto: '[undefined]'
alla prima linea di codice
Set rsPictures = RsMacchina.Fields("Foto").Value
Leggendo qui e la mi dice di creare prima l'oggetto, ma non ho capito cosa vuole mi riscite ad aiutare ??
Grazie