Ciao a tutti ho questo codice che mi da errore ma non capisco il motivo siccome altrove funziona.
<%@Page Language="VB" debug="true"%>
<%@ Register TagPrefix="ControlloUtente" TagName="menu" Src="menu_include.ascx"%>
<%@ Import Namespace="System.Data.OleDb"%>
<script runat="server">
Sub page_load
if not ispostBack then
connetti()
dim strsql as string
dim rs as OleDbDataReader
dim cmdSelect as OleDbCommand
dim id_paese as string
id_paese=request.QueryString("id_paese")
idpaese.text=id_paese
strsql="Select * From Paese where id_paese=" & id_paese
cmdSelect = New OleDbCommand (strsql, conn)
rs=cmdSelect.ExecuteReader()
while rs.Read()
paese.text=rs("paese")
nomeallegato1.text=rs("allegato_1")
end while
rs.close()
conn.close()
end if
end sub
Sub Salva(s as Object, e as EventArgs)
connetti()
dim strsql as string
dim rs as OleDbDataReader
dim cmdInsert as OleDbCommand
dim pathAllegato1 as string
dim allegato1 as string
allegato1=allegato_1.PostedFile.FileName
if allegato1<>"" then
allegato1=nomeFile(allegato_1)
pathAllegato1=server.MapPath(".") & "\..\public\allegati_paese\" & allegato1
allegato_1.PostedFile.SaveAs(pathAllegato1)
end if
strsql="Update Paese set "
strsql=strsql & " paese='" & replace(paese.text, "'", "''") & "'"
if allegato1<>"" then
strsql=strsql & ",allegato_1= '" & replace(allegato1, "'", "''") & "'"
end if
strsql=strsql & " where id_paese=" & idpaese.text
response.Write(strsql)
response.End()
cmdInsert=new OleDbCommand(strsql, conn)
cmdInsert.ExecuteNonQuery()
conn.close
messaggio.text="Modifica effettuata"
end sub
'QUESTA FUNZIONE RITORNA IL NOME DEL FILE CHE L'UTENTE HA SELEZIONATO
function nomeFile(percorso)
dim len_stringa as integer=0
dim pos_slesh as integer=0
dim i as integer
len_stringa=len(percorso)
for i=1 to len_stringa
if mid(percorso, i, 1) = "\" then pos_slesh = i
next
return right(percorso, len_stringa - pos_slesh)
end function
</script>
Ecco l'errore:
Riga 63: dim i as integer
Riga 64:
Riga 65: len_stringa=len(percorso)
Riga 66:
Riga 67: for i=1 to len_stringa
File sorgente: E:\Lavori\MarcoAmato\sipartetour\gestione\mod_paes e.aspx Riga: 65

Rispondi quotando
