Salve a tutti, ho il seguente problema e sono fermo da circa 3 giorni.
Ho una pagina asp con un form composto da piva e altri campi, all'interno di questa pagina devo poter caricare dei dati prelevati da excel o csv, il quale nome del file excel o csv, ha lo stesso nome della partita iva che ho immesso. Il problema è che il campo partita iva non si valorizza finche io non faccio salva sul bottone della form, ma prima di questa operazione devo poter caricare il file suddetto, come faccio a recuperare il valore del campo partita iva prima di eseguire la form?
Codice:
<%
Sub ImportaDatiExcel()
dim NumeroPIva
NumeroPIva = Piva &".xls"
conn1 = "Driver={Microsoft Excel Driver (*.xls)};DBQ=" & Server.MapPath("mdb-database\" & NumeroPIva)
dim RsImport
Set RsImport = Server.CreateObject("ADODB.Recordset")
RsImport.ActiveConnection = conn1
RsImport.Source = "SELECT * from [Pod$]"
RsImport.CursorType = 0
RsImport.CursorLocation = 3
RsImport.LockType = 2
RsImport.Open()
RsImport_numRows = 0
%>
<form name="form1" method="post" action="<%=MM_editAction%>">
<table width="100%" border="0" cellpadding="0" cellspacing="3">
<tr>
<td colspan="6" class="Citazione">INFORMAZIONI AZIENDA</td>
</tr>
<tr>
<!--<td width="2%"></td>-->
<td width="7%" class="label">P Iva</td>
<td><input name="Piva" id="Piva" type="text" maxlength="11" class="TestoRequiredS" onKeyUp="controllaPiva()" required></td>
<td width="7%" class="label">Nome Azienda</td>
<td><input type="text" name="Azienda" required class="TestoRequiredL"></td>
.......
<td class="label"><input name="Import" type="button" class="bottonicarica" value="IMPORTA" on onClick="<%ImportaDatiExcel()%>">Importa da CSV</td>
<td width="40%"></td>
</tr>
</table>
Grazie a tutti

Rispondi quotando



