473,757 Members | 8,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy data from DB1.Table1 (source) to DB2.Table2 (destination).

Hi..

I am working on VB.NET 2003 (windows form) application and using
ADO.NET to deal with databases. The table structure i am working with
is as follows.

DB1.Table1 (source)
=============== =
ID
Name
Address
Flag

DB2.Table2 (destination)
=============== ====
ID
Name
Address

I am looking at copying all the data from DB1.Table1 where "Flag =
True" to DB2.Table2 and mark "Flag = False" in DB1.Tables1 for records
that got copied to DB2.Table2. I was just wondering what would be the
best way to achieve this objective?

This is what i am doing as of now:
- I create a DataSet with 2 tables (Table1 and Table2) having the same
structure as described above.
- I read data from Table1, populate Table2, and mark Flag in Table1 as
False. All this happens in a loop.
- I then update this information in actual database via a Data
Adapter.

Is this an efficient way to perform this task? or is there a better
way to do this?

Thanks.
Hetal.

May 7 '07 #1
0 1154

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1233
by: JC-Atl | last post by:
I have 2 tables in a database: As an example, let's say Table1 has 20 rows, like this: Table1: CategoryNumber CategoryName 1000 Radios 1001 CD Players .... ... 1019 Older Electronics
2
1283
by: ja | last post by:
hi, How copy two table between two database? copy 1 table1 to 2 table2 1 - cursor number, 2 - cursor number, table1 - sourse table table2 - destination table
5
8733
by: Peter CCH | last post by:
Let's say, I have Table1 and Table2, both with the exactly same structure and data in it, except that Table1.Field1 is empty in data but Table2.Field1 have data in it. How could I copy all the data from Table2.Field1 to Table1.Field1? Is there any simpler way except looping through all the records to do it?
1
2567
by: Sean Howard | last post by:
Dear All, As is my want I need to do something in Access that seems simple but cannot fathom out. I have main form with two subforms, both datasheets with an almost identical table structure. I want to add the functionality to copy records from subformA to subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
4
1407
by: Dejan | last post by:
Hy Sorry for my terreble english. I have mysql table1 on my local comp. It looks something like this. ---------------------------------------------------------------------------- - broj_tel | poruka | sifra | grad | id |
4
5694
by: GTi | last post by:
I have two identical tables with one IDENTITY column and several other columns. I have tested the COPY * INTO table2 FROM table1 WHERE xx but it requers that table2 does not exist. TABLE2 is a history database of TABLE1 How can I copy row(s) from table1 to table2 without conflict with IDENTITY columns using SQL query. Or must I do this from a program (C# .NET)
10
17942
by: pbd22 | last post by:
Hi. Like the title says - how do i do this? I was given the following example: INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A' The above statement threw the following error:
14
6993
by: Yas | last post by:
Hello, I have 2 tables, Table1 and Table2. I have copied all data from Table1 to Table2. However Table1 is dynamic it has new rows added and some old rows modified everyday or every other day... How can I continue to keep Table2 up to date without always having to copy everything from Table1? Basically from now on I would only like to copy new rows or modified
6
2944
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1) Constraint pk_table1 Primary Key,
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.