DarkBoost Posted July 16, 2009 Share Posted July 16, 2009 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_Startup() _SQLite_Open() _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 & "');") _SQLite_Close() _SQLite_Shutdown() 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 errordata1.txtdata2.txt Link to comment Share on other sites More sharing options...
KaFu Posted July 16, 2009 Share Posted July 16, 2009 (edited) $var1 = StringReplace($var1,"'","´") The single quote in "Chang's Soy Sauce" is busting the statement quote's. Edited July 16, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Zedna Posted July 16, 2009 Share Posted July 16, 2009 You may also use _SQLite_Encode() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
DarkBoost Posted July 16, 2009 Author Share Posted July 16, 2009 Thank you, I removed the ' and it has worked perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now