Salve a tutti,
ho questo codice asp che da qualche giorno cerco di capire come mai mi da errore,
allora per prima vi faccio vedere il codice:
<form action= "update_txt.asp" method= "post">
<table align="center" border="0" width="500">
<%
Dim strVirtualPath, strFilename, Vars, Commenti, Commento, InizioCommento, FileObject, oInStream, strOutput, Buf, Idx, Index, ParteVariabile, ParteCommento
strVirtualPath = "Connections/inc_txt.asp"
strFilename = Server.MapPath(strVirtualPath)
Idx = 0
Index = 0
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0)
While NOT oInStream.AtEndOfStream
strOutput = oInStream.ReadLine
Buf = Ucase(Left(Trim(strOutput), 3))
Commento = ""
If Trim(Left(Buf, 1)) <> "" and Left(Buf, 1) <> "'" and Left(Buf, 1) <> "<" and Left(Buf, 1) <> "%" Then
If Buf <> "DIM" then
InizioCommento = InStrRev(strOutput, "'")
ParteVariabile = Replace(Mid(strOutput, 1, Len(InizioCommento) - 1), "=", "{[(~)]}", 1, 1)
ParteCommento = Mid(strOutput, InizioCommento + 1)
Commenti = Split(strOutput, "'")
If Len(InizioCommento) - 1 > 0 Then
Vars = Split(Trim(ParteVariabile), "{[(~)]}")
Commento = Trim(ParteCommento)
Else
Vars = Split(strOutput,"{[(~)]}")
If Len(Ubound(Vars)) - 1 > 0 Then
Commento = Trim(Vars(0))
End If
End If
If Len(Ubound(Vars)) - 1 > 0 Then
%>
<tr>
<td bgcolor="#FFFFEC" valign=top><b><%=Commento%></b><br>
<%
If Trim(Ucase(Vars(1))) <> "TRUE" and Trim(Ucase(Vars(1))) <> "FALSE" Then
Vars(1) = Replace(Vars(1), "<br>", vbCrLf)
If Mid(Trim(Vars(1)),1,1) = """" And Mid(Trim(Vars(1)),Len(Trim(Vars(1))),1) = """" Then
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="True">
<textarea Name= "<%=Trim(Vars(0))%>" cols="40" rows="5" style="width=380"><%=Replace(Mid(Trim(Vars(1)),2,Len(Trim(Vars(1)))-2),"""""","""")%></textarea>
<br><%
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False">
<textarea Name= "<%=Trim(Vars(0))%>" cols="40" rows="5" style="width=380"><%=Trim(Replace(Vars(1),"""",""))%></textarea>
<br><%
End If
%>
<input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<br><%
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input <%If Trim(Ucase(Vars(1))) = "TRUE" Then%>Checked<%End If%> type="Radio" Name= "<%=Trim(Vars(0))%>" Value="true">Sì <input <%If Trim(Ucase(Vars(1))) = "FALSE" Then%>Checked<%End If%> type="Radio" Name= "<%=Trim(Vars(0))%>" Value="false">No<input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>"><br>
<%
End If
%>
</td>
</tr>
<%
End If
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input type="hidden" Name= "Dim" Value="<%=strOutput%>"><input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<%
End If
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input type="hidden" Name= "Null<%=Idx%>" Value="<%=strOutput%>"><input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<%
idx = idx + 1
If Mid(strOutput, 1, 2) = "'#" Then
If Mid(strOutput, 1, 3) = "'##" Then
%>
<tr>
<td>
</td>
</tr>
<tr>
<td valign=top><br>
<center><font color="#2B4062" size=3><b><%=Mid(strOutput, 4)%></b></font></center><br>
</td>
</tr>
<%
Else
%>
<tr>
<td valign=top>
<center><font color#2B4062"><b><%=Mid(strOutput, 3)%></b></font></center>
</td>
</tr>
<%
End If
End If
End If
Index = Index + 1
Wend
%>
<tr>
<td nowrap valign=top align="right">
<br><input type="Submit" Name= "Go" Value= "Modifica"> <!-- Non modificare il nome di questo campo -->
</td>
</tr>
</table>
</form>
come vedete ho sottolineato in rosso il punto che modificandolo in questo modo:
ParteVariabile = Replace(Mid(strOutput, 1, InizioCommento - 1), "=", "{[(~)]}", 1, 1)
mi da il seguente errore:
Errore di run-time di Microsoft VBScript (0x800A0005)
Chiamata di routine o argomento non validi: 'Mid'
/ecommerce/admin/modifica_parole.asp, line 41
invece la cosa strana che inserendolo come prima, cioè:
ParteVariabile = Replace(Mid(strOutput, 1, Len(InizioCommento) - 1), "=", "{[(~)]}", 1, 1)
la pagina viene visualizzata ma non con i vari campi del form, non solo lo stesso script lo utilizzato anche per un altro sito e funziona perfettamente.
Non so più come fare, cmq se c'e qualcuno che ha un pò di tempo a dedicare a questo script e vedere cosa non va.
Grazie 1000 in anticipo.
ho questo codice asp che da qualche giorno cerco di capire come mai mi da errore,
allora per prima vi faccio vedere il codice:
<form action= "update_txt.asp" method= "post">
<table align="center" border="0" width="500">
<%
Dim strVirtualPath, strFilename, Vars, Commenti, Commento, InizioCommento, FileObject, oInStream, strOutput, Buf, Idx, Index, ParteVariabile, ParteCommento
strVirtualPath = "Connections/inc_txt.asp"
strFilename = Server.MapPath(strVirtualPath)
Idx = 0
Index = 0
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0)
While NOT oInStream.AtEndOfStream
strOutput = oInStream.ReadLine
Buf = Ucase(Left(Trim(strOutput), 3))
Commento = ""
If Trim(Left(Buf, 1)) <> "" and Left(Buf, 1) <> "'" and Left(Buf, 1) <> "<" and Left(Buf, 1) <> "%" Then
If Buf <> "DIM" then
InizioCommento = InStrRev(strOutput, "'")
ParteVariabile = Replace(Mid(strOutput, 1, Len(InizioCommento) - 1), "=", "{[(~)]}", 1, 1)
ParteCommento = Mid(strOutput, InizioCommento + 1)
Commenti = Split(strOutput, "'")
If Len(InizioCommento) - 1 > 0 Then
Vars = Split(Trim(ParteVariabile), "{[(~)]}")
Commento = Trim(ParteCommento)
Else
Vars = Split(strOutput,"{[(~)]}")
If Len(Ubound(Vars)) - 1 > 0 Then
Commento = Trim(Vars(0))
End If
End If
If Len(Ubound(Vars)) - 1 > 0 Then
%>
<tr>
<td bgcolor="#FFFFEC" valign=top><b><%=Commento%></b><br>
<%
If Trim(Ucase(Vars(1))) <> "TRUE" and Trim(Ucase(Vars(1))) <> "FALSE" Then
Vars(1) = Replace(Vars(1), "<br>", vbCrLf)
If Mid(Trim(Vars(1)),1,1) = """" And Mid(Trim(Vars(1)),Len(Trim(Vars(1))),1) = """" Then
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="True">
<textarea Name= "<%=Trim(Vars(0))%>" cols="40" rows="5" style="width=380"><%=Replace(Mid(Trim(Vars(1)),2,Len(Trim(Vars(1)))-2),"""""","""")%></textarea>
<br><%
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False">
<textarea Name= "<%=Trim(Vars(0))%>" cols="40" rows="5" style="width=380"><%=Trim(Replace(Vars(1),"""",""))%></textarea>
<br><%
End If
%>
<input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<br><%
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input <%If Trim(Ucase(Vars(1))) = "TRUE" Then%>Checked<%End If%> type="Radio" Name= "<%=Trim(Vars(0))%>" Value="true">Sì <input <%If Trim(Ucase(Vars(1))) = "FALSE" Then%>Checked<%End If%> type="Radio" Name= "<%=Trim(Vars(0))%>" Value="false">No<input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>"><br>
<%
End If
%>
</td>
</tr>
<%
End If
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input type="hidden" Name= "Dim" Value="<%=strOutput%>"><input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<%
End If
Else
%>
<input type="hidden" Name= "Tipo<%=Index%>" Value="False"><input type="hidden" Name= "Null<%=Idx%>" Value="<%=strOutput%>"><input type="hidden" Name= "Commento<%=Index%>" Value="<%=Commento%>">
<%
idx = idx + 1
If Mid(strOutput, 1, 2) = "'#" Then
If Mid(strOutput, 1, 3) = "'##" Then
%>
<tr>
<td>
</td>
</tr>
<tr>
<td valign=top><br>
<center><font color="#2B4062" size=3><b><%=Mid(strOutput, 4)%></b></font></center><br>
</td>
</tr>
<%
Else
%>
<tr>
<td valign=top>
<center><font color#2B4062"><b><%=Mid(strOutput, 3)%></b></font></center>
</td>
</tr>
<%
End If
End If
End If
Index = Index + 1
Wend
%>
<tr>
<td nowrap valign=top align="right">
<br><input type="Submit" Name= "Go" Value= "Modifica"> <!-- Non modificare il nome di questo campo -->
</td>
</tr>
</table>
</form>
come vedete ho sottolineato in rosso il punto che modificandolo in questo modo:
ParteVariabile = Replace(Mid(strOutput, 1, InizioCommento - 1), "=", "{[(~)]}", 1, 1)
mi da il seguente errore:
Errore di run-time di Microsoft VBScript (0x800A0005)
Chiamata di routine o argomento non validi: 'Mid'
/ecommerce/admin/modifica_parole.asp, line 41
invece la cosa strana che inserendolo come prima, cioè:
ParteVariabile = Replace(Mid(strOutput, 1, Len(InizioCommento) - 1), "=", "{[(~)]}", 1, 1)
la pagina viene visualizzata ma non con i vari campi del form, non solo lo stesso script lo utilizzato anche per un altro sito e funziona perfettamente.
Non so più come fare, cmq se c'e qualcuno che ha un pò di tempo a dedicare a questo script e vedere cosa non va.
Grazie 1000 in anticipo.
Ultima modifica: