473,382 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

inserting to one database from another

Hi,

I am trying to insert records from one database to another.

I am passing in a SourceDataSet created from the SourceDatabase and a DestinationDatabaseConnection (that is open). I just need to know how to put the SourceDataSet into the destination database. (the table exists in the destination and has the same field names)

i am trying something like below, however i am not sure how the syntax of the parameter needs to be to reference the columns of the source dataset or if that is how to do it.

Dim dbDataAdapter As New SqlDataAdapter

dbDataAdapter.InsertCommand = New SqlCommand
dbDataAdapter.InsertCommand.Connection = dbDestinationConnection
dbDataAdapter.InsertCommand.CommandText = "INSERT INTO DestTable "
"(DestCol1, DestCol2) "
"VALUES (@Col1, @Col2)" dbDataAdapter.InsertCommand.Parameters.AddWithValu e("@Col1", dbSourceDataSet.Tables("Table").Columns("Col1"))
dbDataAdapter.InsertCommand.Parameters.AddWithValu e("@Col2", dbAccessDataSet.Tables("Association").Columns("Col 2"))
dbDataAdapter.InsertCommand.ExecuteNonQuery()
Jul 18 '08 #1
0 783

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: pramod | last post by:
Hi I am facing the problem while inserting the spanish characters in the DB2 UDB v8.2 database. We are pulling the data from SQL server through informatica and then pushing the same in the DB2...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
11
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so many parameters need to be passed into store...
5
by: bob44 | last post by:
Hi, I recently created a mysql database using phpmyadmin. I then proceeded to make a form to insert data into the database, but the problem is that the form is only able to insert one record, and...
3
by: Surya | last post by:
Dear All, I have problem on inserting a record to database..Although it looked easy.. i have caught up with following issue .. please go ahead and help me to find solution I Need to insert...
10
by: backups2007 | last post by:
Is it possible to call a database entry and pass it to another table right after inserting it in the database? example: $query = mysql_query("INSERT INTO tblProducts (item_code, description)...
0
by: toyin | last post by:
hello, pls help look through this code its not inserting the record in dataset into the another database. i want to insert the row in the dataset into another table in another database. pls help....
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
6
by: Bunty | last post by:
I want to insert values in the database.If i insert values one by one then it works till 4 or 5 fields then after it gives error.In my database there are more than 20 field.Pls help me.
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.