Ciao a tutti.
Con uno script ASP importo un file csv in mysql.
Va tutto bene, ma non capisco perchè nell'inserimento la query registra anche quelli che dovrebbero essere i nomi delle colonne.
Sapete aiutarmi?codice:D:\Inetpub\wwwroot\PSIC20071031144905.csv INSERT INTO tbl ( sis, origine, `id sistema` ) VALUES ( 'sis', 'origine', 'idsistema' )
codice:<% Server.ScriptTimeout = 10000 Response.Buffer = false Set objFSO = Server.CreateObject("Scripting.FileSystemObject") strURL = Server.MapPath("PSIC20071031144905.csv") Set objFile = objFSO.OpenTextFile(strURL) Do While Not objFile.AtEndOfStream strText = objFile.readLine arrText = split(strText, ",", 17) strSIS = replace(arrText(0), """", " ") strORIGINE = replace(arrText(1), """", " ") strIDSISTEMA = replace(arrText(2), """", " ") strSql = "INSERT INTO " strSql = strSql & " tbl " strSql = strSql & " ( " strSql = strSql & " sis, " strSql = strSql & " origine, " strSql = strSql & " `id sistema` " strSql = strSql & " ) " strSql = strSql & " VALUES " strSql = strSql & " ( " strSql = strSql & " '"& replace(strSIS, " ", "") & "', " strSql = strSql & " '"& replace(strORIGINE, " ", "") & "', " strSql = strSql & " '"& replace(strIDSISTEMA, " ", "") & "' " strSql = strSql & " ) " cn.execute(strSql) Loop objFile.Close Set objFile = Nothing cn.Close Set cn = nothing %>

Rispondi quotando
