Jump to content
Sign in to follow this  

_SQLite_Exec() and adding multiple lines of data

Recommended Posts


My SQL skills are limited so I am unsure how to resolve this SQL issue?

Data1.txt fails to add but Data2.txt is successful.

Any help would be greatly appreciated.

The AutoIT Code:

#include <SQLite.au3>
#include <SQLite.dll.au3>

$var1 = FileRead(@ScriptDir & "\data1.txt")
$var2 = FileRead(@ScriptDir & "\data2.txt")

_SQLite_Exec(-1, "CREATE TABLE test (a, b, c);")
_SQLite_Exec(-1, "INSERT INTO test VALUES ('hello', 'world', '" & $var1 & "');")
_SQLite_Exec(-1, "INSERT INTO test VALUES ('hello', 'world', '" & $var2 & "');")

The error provided:

!   SQLite.au3 Error
--> Function: _SQLite_Exec
--> Query:    INSERT INTO test VALUES ('hello', 'world', '1/2 cup tomato sauce
1/4 cup honey
2 tablespoons Chang's Soy Sauce
2 tablespoons malt vinegar
1 tablespoon brown sugar
1 teaspoon powdered mustard
1kg beef ribs
vegetable oil, for deep-frying
4 Sebago potatoes, peeled, very thinly sliced
dressed spinach leaves, to serve');
--> Error:    near "s": syntax error



Share this post

Link to post
Share on other sites

$var1 = StringReplace($var1,"'","´")

The single quote in "Chang's Soy Sauce" is busting the statement quote's.

Edited by KaFu

Share this post

Link to post
Share on other sites

Thank you, I removed the ' and it has worked perfectly.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.