Jump to content
Sign in to follow this  
faustf

csv split and if why not recognize a content?

Recommended Posts

faustf

hi guys  i have a csv , i attached ,   i  have create a script for insert inside of db 

_main()

Func _main()


    Local $hTimer = TimerInit()
    Local $aLListinoComp = FileReadToArray(@ScriptDir & "\WEB-SITE\CGross\xls\listino.csv") ; listino completo
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file.
    EndIf
    ;_ArrayDisplay($aLListinoComp)

    For $i = 0 To UBound($aLListinoComp) - 1

        Local $aLPart = StringSplit($aLListinoComp[$i], ';')
        #cs
Local $sStrippedString = StringStripCR($aLListinoComp[3])
        If $sStrippedString = "Prezzo Listino" Then
            MsgBox(0, '', 'de made ')
        EndIf
#ce
        

            If $aLListinoComp[3] = "Prezzo Listino" Then


            ElseIf $aLListinoComp[3] = "" Then

            Else
            _ArrayDisplay($aLPart)
            Local $sLSyntax = "INSERT INTO ge_CGross_listino (codice,DescProd,Produttore,DescCatMerc,Dispo,PrezzoSiSconto,Grossista)" & _
            " VALUES ('" & $aLListinoComp[1] & "','" & $aLListinoComp[2] & "','" & $aLListinoComp[8] & "','" & $aLListinoComp[9] & "','" & $aLListinoComp[6] & "','" & $aLListinoComp[5] & "', 'CompGross' )"
            Local $sLQueryResult = _Mysql_Query($sLSyntax)
            If @error Then
            SetError(@error, @extended, $ADO_RET_FAILURE)
            EndIf
            EndIf
        

    Next
    Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
    ConsoleWrite("Time Difference= " & $fDiff)
    MsgBox($MB_SYSTEMMODAL, "Time Difference", $fDiff)
    
    endfunc

the problem always popup _arraydisplay($aLPart) also when inside of  $aLListinoComp[3] = "Prezzo Listino"  , why  do this ??? 

 

listino2.csv

Share this post


Link to post
Share on other sites
faustf

sorry i find a solution i invert a array sorry 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×