Jump to content

help with quotes


gcue
 Share

Recommended Posts

i am inserting values from a text file into a sqlite database.

first i create the array then cycle through each array record and insert it into a sql table.

For $y = 0 To UBound($avOut) - 1
     $aTemp[0] = "'" & $avOut[$y][0] & "'"
        $aTemp[1] = "'" & $avOut[$y][1] & "'"
        $aTemp[3] = "'" & $avOut[$y][3] & "'"

        $sTemp = $aTemp[0] & "," & $aTemp[1] & "," & $aTemp[3]

        _SQLite_Exec(-1, "INSERT INTO aAssetInfo (Tag,Status,Type) VALUES (" & $sTemp & ");")
Next

the problem i am running into is when a data field has a single quote, then that record is not inserted. how should i specify the quotes here

"'" & $avOut[$y][0] & "'"
to get around that?

thanks in advance!

Link to comment
Share on other sites

  • Developers

Something like this for each line:

$aTemp[0] = "'" & StringReplace($avOut[$y][0],"'","''") & "'"

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...