Buenas noches a todos.
Apro questa discussione per chè ho un problema che per me non è di facile soluzione:
Importo in un db mysql, tramite una procedura ASP una serie di campi contenuti in un file excel come da img allegata.
L'importazione funziona correttamente sino a quando non provo ad importare anche il valore della riga MARCHIO (nell'img allegata ACQUA AL BANCO).
Posto anche il codice per l'importazione per sapere se avete suggerimenti su come risolvere il problema:
codice:'STRINGA DI CONNESSIONE AL FILE EXCEL Dim adoCn Set adoCn = CreateObject("ADODB.Connection") With adoCn .Provider="Microsoft.Jet.OLEDB.4.0" .ConnectionString="Data Source="&Server.MapPath("VENDUVAL.XLS")&";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" .Open End With 'QUERY DI APERTURA DEL FOGLIO XLS Dim doRs Set doRs = CreateObject("ADODB.Recordset") stQuery = "SELECT * from [VENDUVAL$]" With doRs Set .ActiveConnection = adoCn .Open stQuery End With strVariabileData = (doRs(1).name) Dim adoRs Set adoRs = CreateObject("ADODB.Recordset") strQuery = "SELECT * from [VENDUVAL$] " strQuery = strQuery & " WHERE " strQuery = strQuery & " ["&strVariabileData&"] <> 'Codice a barre' " strQuery = strQuery & " and ["&strVariabileData&"] <> 'DALLA DATA:' " strQuery = strQuery & " and ["&strVariabileData&"] <> 'Categoria merceologica:' " strQuery = strQuery & " and ["&strVariabileData&"] <> 'Linea:'" With adoRs Set .ActiveConnection = adoCn .Open strQuery End With If adoRs.EOF then response.write "Nessun dato da importare" else for i=0 to adoRs.fields.count -1 response.Write(adoRs(i).name&" ") 'visualizzo i nomi dei campi per sfizio next response.Write(" NUMERO CAMPI: "&adoRs.fields.count&" ") ' lo stesso il numero dei campi adoRs.MoveFirst Do While Not adoRs.Eof for i=0 to adoRs.fields.count -1 valore_campo = adoRs(i) next 'STAMPO LE RIGHE CHE MI INTERESSANO response.write adoRs(1) &" ---> adoRs1 " response.write adoRs(3) &" ---> adoRs3 " response.write adoRs(4) &" ---> adoRs4 "

Rispondi quotando