2 Replies - 216 Views - Last Post: 30 September 2019 - 06:02 AM Rate Topic: -----

#1 gurchani   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-September 19

vb.net odp.net select query from one database1.table and create table

Posted 30 September 2019 - 05:21 AM

i have two servers (A and B) both have oracle 11g installed on rhel6, vb.net installed on my laptop. i am writing a code in vb.net 2015 (done testing connections with two oracle servers) to select rows from a table of one database (server A) and insert these rows in second database (server B), how can i do this using odp.net, please guide.

my connection is as under:

Dim OraConnStringDB1 As String = "Data Source=" & TextBox5.Text & ":1521/ " & TextBox6.Text & ";User Id=" & TextBox7.Text & " ;Password=" & TextBox8.Text & " ;"
Dim OraConnStringDB2 As String = "Data Source=" & TextBox5.Text & ":1521/ " & TextBox6.Text & ";User Id=" & TextBox7.Text & " ;Password=" & TextBox8.Text & " ;"

Dim OraConnDB1 As New OracleConnection(OraConnStringDB1)
OraConnDB1.Open()

Dim OraConnDB2 As New OracleConnection(OraConnStringDB2)
OraConnDB2.Open()

Dim cmd As New OracleCommand
cmd.Connection = OraConnDB1
cmd.CommandText = "select * from ahmad t where t.ahmad_id=1"

Is This A Good Question/Topic? 0
  • +

Replies To: vb.net odp.net select query from one database1.table and create table

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15314
  • View blog
  • Posts: 61,406
  • Joined: 12-June 08

Re: vb.net odp.net select query from one database1.table and create table

Posted 30 September 2019 - 05:44 AM

You would SELECT the data from the first into a dataset using an adapter.
You would cycle through that data set to fill parameters for an INSERT into the second.

Ex:
https://www.dreaminc...-adapter-setup/
https://www.dreaminc...-command-setup/
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6819
  • View blog
  • Posts: 28,250
  • Joined: 12-December 12

Re: vb.net odp.net select query from one database1.table and create table

Posted 30 September 2019 - 06:02 AM

You could investigate Bulk Copy, although, the page does state that "ODP.NET, Managed Driver does not support Bulk Copy." which seems a bit of a contradiction.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1