Click here to Skip to main content
15,861,125 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: this is my code trying to deduct qty from tableproduct after sales Pin
Victor Nijegorodov7-Jul-22 0:31
Victor Nijegorodov7-Jul-22 0:31 
GeneralRe: this is my code trying to deduct qty from tableproduct after sales Pin
jsc427-Jul-22 1:07
professionaljsc427-Jul-22 1:07 
GeneralRe: this is my code trying to deduct qty from tableproduct after sales Pin
Richard MacCutchan7-Jul-22 1:27
mveRichard MacCutchan7-Jul-22 1:27 
AnswerRe: this is my code trying to deduct qty from tableproduct after sales Pin
Richard Deeming7-Jul-22 2:08
mveRichard Deeming7-Jul-22 2:08 
QuestionRaise Event on another Form Pin
EngrImad21-Jun-22 5:01
EngrImad21-Jun-22 5:01 
AnswerRe: Raise Event on another Form Pin
Dave Kreskowiak22-Jun-22 7:18
mveDave Kreskowiak22-Jun-22 7:18 
GeneralRe: Raise Event on another Form Pin
jsc426-Jul-22 6:23
professionaljsc426-Jul-22 6:23 
QuestionCopy Record(s) from 1 Database to Another Database with the same Tables Pin
crmfghtr20-Jun-22 16:42
crmfghtr20-Jun-22 16:42 
Hi Everyone,
I hope I'm posting this in the right place. I'm using VistaDb version 6.2 I have a Main Database with several tables Like Clients, Inventory, etc. I have a Backup Database with the same table(s) and structure as the Main database. I'm trying to copy 1 or more records from the Backup Database, like the Inventory Table to the Main Database Inventory Table. The code below is inserting records from the Main database inventory table, and not from the backup database. Do I need to do this by First selecting the data and placing it in a tmp table then insert the records from the tmp table? Any help would be appreciated.

Here is the code I have:
VB
Private Sub TransferInventory()

    Dim MyFile As String = TreeListTransfer.FocusedNode(0).ToString
    Dim VdbConn1 As String = "Data Source=" & Application.StartupPath & "\Backup\" & MyFile & ".vdb6"
    Try
        'Count the files in the Listbox
        For i As Integer = 0 To LstFiles.Items.Count - 1
            LstFiles.SelectedIndex = i
            FileId = CInt(LstFiles.Text)

            'Add the Contents to the Database
            Using conn As New VistaDBConnection(VdbConn)
                conn.Open()
                StrSql = "INSERT INTO Inventory(ClientId, Category, Product, PartNo, PurchaseDate, Unit, UnitPrice, InStock, OnOrder, Photo)
                      SELECT ClientId, Category, Product, PartNo, PurchaseDate, Unit, UnitPrice, InStock, OnOrder, Photo
                      FROM dbo.Inventory
                      WHERE (InventoryId = @InventoryId)"

                Using cmd As New VistaDBCommand(StrSql, conn)
                    With cmd.Parameters
                        .AddWithValue("@InventoryId", FileId)
                    End With
                    'Execute the Statement

                    cmd.ExecuteNonQuery()
                    'Close the Connection
                    conn.Close()
                End Using
            End Using

        Next
        MessageBox.Show("Transfer successfully completed on the 'Inventory' table", "Transfer Inventory Data", MessageBoxButtons.OK, MessageBoxIcon.Information)
    Catch ex As Exception
        MessageBox.Show(ex.Message, "Transfer Inventory Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Return
    Finally

    End Try

End Sub


Thanks in Advance.
AnswerRe: Copy Record(s) from 1 Database to Another Database with the same Tables Pin
Victor Nijegorodov20-Jun-22 20:24
Victor Nijegorodov20-Jun-22 20:24 
QuestionGet Process Percentage Pin
EngrImad18-Jun-22 8:33
EngrImad18-Jun-22 8:33 
AnswerRe: Get Process Percentage Pin
PIEBALDconsult18-Jun-22 8:35
mvePIEBALDconsult18-Jun-22 8:35 
GeneralRe: Get Process Percentage Pin
EngrImad19-Jun-22 0:22
EngrImad19-Jun-22 0:22 
GeneralRe: Get Process Percentage Pin
Dave Kreskowiak19-Jun-22 8:00
mveDave Kreskowiak19-Jun-22 8:00 
GeneralRe: Get Process Percentage Pin
EngrImad19-Jun-22 3:57
EngrImad19-Jun-22 3:57 
AnswerRe: Get Process Percentage Pin
Richard Deeming19-Jun-22 21:41
mveRichard Deeming19-Jun-22 21:41 
AnswerRe: Get Process Percentage Pin
David Mujica22-Jun-22 3:42
David Mujica22-Jun-22 3:42 
QuestionStrange behavior readline Pin
JR21214-Jun-22 1:05
JR21214-Jun-22 1:05 
AnswerRe: Strange behavior readline Pin
Richard MacCutchan14-Jun-22 5:16
mveRichard MacCutchan14-Jun-22 5:16 
GeneralRe: Strange behavior readline Pin
JR21216-Jun-22 2:16
JR21216-Jun-22 2:16 
AnswerRe: Strange behavior readline Pin
Alan N14-Jun-22 5:30
Alan N14-Jun-22 5:30 
GeneralRe: Strange behavior readline Pin
JR21216-Jun-22 2:13
JR21216-Jun-22 2:13 
QuestionDatabase relating entity having various data members Pin
lazy_dude12-Jun-22 20:17
lazy_dude12-Jun-22 20:17 
AnswerRe: Database relating entity having various data members Pin
Richard Deeming12-Jun-22 21:26
mveRichard Deeming12-Jun-22 21:26 
GeneralRe: Database relating entity having various data members Pin
lazy_dude12-Jun-22 23:03
lazy_dude12-Jun-22 23:03 
QuestionDataGridView Multi Layer Header Pin
EngrImad11-Jun-22 3:33
EngrImad11-Jun-22 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.