Has anybody ever used this ATTTACH command?
Still doesn't work

        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 =
"C:\Users\Chris\Documents\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;"
            Dim dbcommand As SQLiteCommand = dbConnection.CreateCommand
            With dbcommand
                .CommandText = SQLStmt
                .ExecuteNonQuery()
                .Dispose()
            End With
            SQLStmt = "INSERT INTO UPD.Items (" _
                    & "[Category]," _
                    & "[Supplier]," _
                    & "[Product Code]," _
                    & "[Short Description]," _
                    & "[Long Description]," _
                    & "[Unit Price]," _
                    & "[Maximum Sample Quantity]," _
                    & "[Box Price]," _
                    & "[Box Quantity]," _
                    & "[Deleted]," _
                    & "[Item Image File Path]," _
                    & "[Last Update]" _
                    & ") VALUES (" _
                    & "'AAA'," _
                    & "'BBB'," _
                    & "'XXX'," _
                    & "'DDD'," _
                    & "'EEE'," _
                    & "100," _
                    & "200," _
                    & "300," _
                    & "400," _
                    & "'NO'," _
                    & "'C:\XYZ.jpg'," _
                    & "''" _
                    & ")"
            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


On 13 August 2015 at 12:09, Simon Slavin <slavins at bigfraud.org> wrote:

>
> On 13 Aug 2015, at 10:16am, Chris Parsonson <z2668856 at gmail.com> wrote:
>
> > the ATTACH gives no error in either my first
> > attempt or this second one.
>
> Then it's probably working.
>
> >            SQLStmt = "ATTACH '" & sUpdateDBPath & "' AS UPD;"
>
> So after you've done that, write some code to insert a new row into a
> table in UPD and then try to read the row back and see if it's there.
>
> 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

Reply via email to