On Fri, Jul 31, 2015 at 3:38 AM, Chris Parsonson <z2668856 at gmail.com> wrote:
> Forgot to add the code > Public Function SynchroniseDB() As Boolean > Dim dbConnection As New SQLiteConnection > Dim dbDataSet As New DataSet > Dim SQLStmt As String > Dim sDBPath As String = Application.StartupPath & "\wolfpro.db3" > Dim sUpdateDBPath As String = Application.StartupPath & > "\UpdateWolfpro.db3" > Try > If dbConnection.State = ConnectionState.Closed Then > dbConnection.ConnectionString = "Data Source=" & sDBPath & > ";New=True;Compress=True;Synchronous=Off" > dbDataSet.Locale = CultureInfo.InvariantCulture > dbConnection.Open() > dbDataSet.Reset() > End If > SQLStmt = "ATTACH '" & sUpdateDBPath + "' AS UPD;" > Should that + be a & ? -- -- -- --???-- K e V i N > Dim dbcommand As SQLiteCommand = dbConnection.CreateCommand > With dbcommand > .CommandText = SQLStmt > .ExecuteNonQuery() > .Dispose() > End With > SQLStmt = "DELETE FROM UPD.Items;" > Dim dbcommand2 As SQLiteCommand = dbConnection.CreateCommand > With dbcommand2 > .CommandText = SQLStmt > .ExecuteNonQuery() > .Dispose() > End With > Return True > Catch ex As Exception > MessageBox.Show(ex.Message) > Return False > End Try > End Function > > > On 31 July 2015 at 09:37, Chris Parsonson <z2668856 at gmail.com> wrote: > > > Thanks, > > Here is my code again, hopefully with typing errors corrected. The attach > > and the delete run without generating any errors, but the delete does not > > work > > > > On 31 July 2015 at 09:25, Rowan Worth <rowanw at dugeo.com> wrote: > > > >> Chris, you have an extra pair of single quotes in your original code > >> compared to Simon's suggestion. Also in your parameter-based attempt you > >> have a typo when assigning the path (@DNName instead of @DBName). > >> > >> Hope that helps, > >> -Rowan > >> > >> > >> On 31 July 2015 at 15:09, Chris Parsonson <z2668856 at gmail.com> wrote: > >> > >> > That's exactly what I started with, then somebody suggested using a > >> > parameter > >> > > >> > On 31 July 2015 at 09:02, Simon Slavin <slavins at bigfraud.org> wrote: > >> > > >> > > > >> > > On 31 Jul 2015, at 5:32am, Chris Parsonson <z2668856 at gmail.com> > >> wrote: > >> > > > >> > > > SQLStmt = "ATTACH '" & sUpdateDBPath & "' AS UPD" > >> > > > >> > > This is not the correct syntax for the ATTACH command. The name of > >> the > >> > > file to be attached is not a value, it's just included in the > >> command. I > >> > > would expect you to have better results using something like > >> > > > >> > > SQLStmt = "ATTACH " & sUpdateDBPath & " AS UPD" > >> > > > >> > > You must, of course, make sure that the sUpdateDBPath specifies a > >> place > >> > > that your application does have access to. You can test this by > >> > inserting > >> > > a few test lines which open a database of that location. > >> > > > >> > > Simon. > >> > > _______________________________________________ > >> > > sqlite-users mailing list > >> > > sqlite-users at mailinglists.sqlite.org > >> > > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > >> > > > >> > > >> > > >> > > >> > -- > >> > Chris Parsonson > >> > 083 777 9261 > >> > _______________________________________________ > >> > sqlite-users mailing list > >> > sqlite-users at mailinglists.sqlite.org > >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > >> > > >> _______________________________________________ > >> sqlite-users mailing list > >> sqlite-users at mailinglists.sqlite.org > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > >> > > > > > > > > -- > > Chris Parsonson > > 083 777 9261 > > > > > > -- > Chris Parsonson > 083 777 9261 > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >