in chiusura pagina :
Function GetLastFoto(ByVal sCodice)
Dim oCon
Dim oRS
Dim nIndex
GetLastFoto = ""
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("111.mdb") & ";Mode=ReadWrite"
Set oRS = oCon.Execute("select top 1 Indice from fotoimmobili2 where CodiceImmobile=" & sCodiceimmobile & " and Pubblica <>0 order by Indice desc")
If Not oRS.Eof Then
nIndex = oRS("Indice")
Else
nIndex = 0
End If
oRS.Close
If nIndex>0 Then
Set oRS = oCon.Execute("select Foto" & nIndex & " As Foto from immobili where CodiceImmobile=" & sCodiceimmobile)
If Not oRS.Eof Then
GetLastFoto = oRS("Foto")
oRS.Close
End If
End If
oCon.Close
Set oRS = Nothing
Set oCon = Nothing
End Function
vorrei crearne altre 3 concatenate ho provato cosi differenziando il nome getlastfoto1 a 2 a 3:
Function GetLastFoto1(ByVal sCodice)
Dim oCon
Dim oRS
Dim nIndex
GetLastFoto1 = ""
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("111.mdb") & ";Mode=ReadWrite"
Set oRS = oCon.Execute("select top 1 Indice from fotoimmobili2 where CodiceImmobile=" & sCodiceimmobile & " and Pubblica <>0 order by Indice desc")
If Not oRS.Eof Then
nIndex = oRS("Indice")
Else
nIndex = 0
End If
oRS.Close
If nIndex>0 Then
Set oRS = oCon.Execute("select Foto" & nIndex & " As Foto from immobili where CodiceImmobile=" & sCodiceimmobile)
If Not oRS.Eof Then
GetLastFoto1 = oRS("Foto")
oRS.Close
End If
End If
oCon.Close
Set oRS = Nothing
Set oCon = Nothing
End Function
Function GetLastFoto2(ByVal sCodice)
Dim oCon
Dim oRS
Dim nIndex
GetLastFoto2 = ""
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("111.mdb") & ";Mode=ReadWrite"
Set oRS = oCon.Execute("select top 1 Indice from fotoimmobili3 where CodiceImmobile=" & sCodiceimmobile & " and Pubblica <>0 order by Indice desc")
If Not oRS.Eof Then
nIndex = oRS("Indice")
Else
nIndex = 0
End If
oRS.Close
If nIndex>0 Then
Set oRS = oCon.Execute("select Foto" & nIndex & " As Foto from immobili where CodiceImmobile=" & sCodiceimmobile)
If Not oRS.Eof Then
GetLastFoto2 = oRS("Foto")
oRS.Close
End If
End If
oCon.Close
Set oRS = Nothing
Set oCon = Nothing
End Function
Function GetLastFoto3(ByVal sCodice)
Dim oCon
Dim oRS
Dim nIndex
GetLastFoto3 = ""
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("111.mdb") & ";Mode=ReadWrite"
Set oRS = oCon.Execute("select top 1 Indice from fotoimmobili4 where CodiceImmobile=" & sCodiceimmobile & " and Pubblica <>0 order by Indice desc")
If Not oRS.Eof Then
nIndex = oRS("Indice")
Else
nIndex = 0
End If
oRS.Close
If nIndex>0 Then
Set oRS = oCon.Execute("select Foto" & nIndex & " As Foto from immobili where CodiceImmobile=" & sCodiceimmobile)
If Not oRS.Eof Then
GetLastFoto3 = oRS("Foto")
oRS.Close
End If
End If
oCon.Close
Set oRS = Nothing
Set oCon = Nothing
End Function
Function GetLastFoto4(ByVal sCodice)
Dim oCon
Dim oRS
Dim nIndex
GetLastFoto4 = ""
Set oCon = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("111.mdb") & ";Mode=ReadWrite"
Set oRS = oCon.Execute("select top 1 Indice from fotoimmobili5 where CodiceImmobile=" & sCodiceimmobile & " and Pubblica <>0 order by Indice desc")
If Not oRS.Eof Then
nIndex = oRS("Indice")
Else
nIndex = 0
End If
oRS.Close
If nIndex>0 Then
Set oRS = oCon.Execute("select Foto" & nIndex & " As Foto from immobili where CodiceImmobile=" & sCodiceimmobile)
If Not oRS.Eof Then
GetLastFoto4 = oRS("Foto")
oRS.Close
End If
End If
oCon.Close
Set oRS = Nothing
Set oCon = Nothing
End Function
il record va a pescare la funcion cosi
<%
sFoto2 = GetLastFoto2(oRS("codiceimmobile"))
If sFoto2<>"" Then
%>[img]../public/<%=sFoto2%>[/img]
<%
End if%>
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'GetLastFoto2'
/ddd324/pubblicita_risultato.asp, line 359
come correggere l'errore ....?
fammi sapere
ciao grazie

Rispondi quotando