title: Select Statement for localhost and insert into network database
body: <p>module for localhost connection</p>
  
  <h1>This is my module for connecting localhost</h1>
  
  <pre><code>    Function connect()
      con.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};server=localhost;database=tablelocal;uid=root;pwd=root;option=0"     
      con.Open()
      End Function
  
      Function Disconnect()
      con.Close()
      End Function
  </code></pre>
  
  <p>module for network connection</p>
  
  <h1>This is my module for connecting through network</h1>
  
  <pre><code>    Function connectnetwork()
      con.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};server=192.168.0.1;database=samplenetwork;uid=root;pwd=root;option=0"     
      con.Open()
      End Function
  
      Function Disconnectnetwork()
      con.Close()
      End Function
  </code></pre>
  
  <h1>Please See my edit</h1>
  
  <pre><code>    Dim sourceConnection As New OdbcConnection(connect())
      Dim destinationConnection As New OdbcConnection(connectNetwork())
      Dim adapter As New OdbcDataAdapter("SELECT * from local ", sourceConnection)
      Dim insertCommand As New OdbcCommand("INSERT INTO network", destinationConnection)
  
      With insertCommand.Parameters
          OdbcCommand = New Odbc.OdbcCommand("Insert into network select * from local ", con)
          OdbcCommand.ExecuteNonQuery()   
      End With
  
      adapter.InsertCommand = insertCommand
  
      'Keep the RowState of each row as Added so it is ready to be inserted.'
       adapter.AcceptChangesDuringFill = False
  
      Dim table As New DataTable
  
      'Retrieve data from source database.'
       adapter.Fill(table)
  
      'Save data to destination database.'
       adapter.Update(table)
  </code></pre>