473,385 Members | 1,356 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,385 software developers and data experts.

C# Data Insertion

Hi All,
I am working on a Data Project, that involves records (rows) to be inserted from a Table in one database to an exactly similar table in another database. The table names and all field names and values are exactly same.
I am looking for Mass insertions or should i say, the easiest way to insert these records. What are my options? i don't want to use the individual OleDbCommand insert statements since that is a rather slow process.
Also the need to use DataAdapter and the schema details is not the best option since both the tables are exactly same.
However Database 1 is access and the Database 2 is SQL server. (So the connections are different and so on....)
Here is a little desc of the prob

Database1 (TableClientDetials) ----------- > (Insert all Records to) -------> Database2 (TableClientDetails)
From (Access) (On SQL Server)
Nov 15 '05 #1
3 1997
Sunny,

I would actually use a parameterized OleDbCommand and cycle through the
rows, inserting the values from the old data source (retrieved through a
call to Fill on the data adapter) using the values in the data set. The
reason I would do this is because you can not change the RowState on the
data set to indicate that the records should be added. Because of that, you
will have to insert the records manually (or find a way to change the
RowState, possibly by copying the records to a new data set).

However, you could probably use DTS services through COM interop to copy
the records as well.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sunny" <gh**********@yahoo.com> wrote in message
news:AC**********************************@microsof t.com...
Hi All,
I am working on a Data Project, that involves records (rows) to be inserted from a Table in one database to an exactly similar table in another
database. The table names and all field names and values are exactly same. I am looking for Mass insertions or should i say, the easiest way to insert these records. What are my options? i don't want to use the
individual OleDbCommand insert statements since that is a rather slow
process. Also the need to use DataAdapter and the schema details is not the best option since both the tables are exactly same. However Database 1 is access and the Database 2 is SQL server. (So the connections are different and so on....) Here is a little desc of the prob

Database1 (TableClientDetials) ----------- > (Insert all Records to) -------> Database2 (TableClientDetails) From (Access)

(On SQL Server)
Nov 15 '05 #2
Jax
Couldn't you just get a dataset from both tables and then add all of the rows from DataSet1 to DataSet2 and then call an update on DataSet2
I'm not usually the best person to ask as I am usually the one being helped rather then doing the helping but I think that would work o.k

jax
Nov 15 '05 #3
But that still needs an adapter with an insert statement that is the same thing as using a command with insert statement.
Nov 15 '05 #4

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

Similar topics

3
by: Raju V.K | last post by:
I am developing a PHP-mysql database. It is noted that when the browser window is refreshed the data is inserted again in the database. unfortunately there is no unique keys that I can use to...
4
by: spar | last post by:
I'm converting a Perl script to Python and have run into something I'm not sure how to do in Python. In Perl, I am running through a couple loops and inserting values directly into a complex...
0
by: David List | last post by:
I am wondering what I miss to be able to handle binary data from the mysql client. I have ensured that the user has file_priv set to 'Y' and that max_allowed_packet is larger that the binary lumps...
2
by: Kushal | last post by:
Hello, I am trying to build a dynamic set/list of data which should be sorted as each element is inserted. The main criteria in this list is the speed, the time it takes to insert a element,...
20
by: Patrick Guio | last post by:
Dear all, I have some problem with insertion operator together with namespace. I have a header file foo.h containing declaration of classes, typedefs and insertion operators for the typedefs in...
22
by: Curious | last post by:
Hi, I am searching for a data structure that stores key-value pairs in it. This data structure is to hold large amounts of key-value pairs, and so needs to be efficient both in insertion and...
1
by: dtefran3 | last post by:
The problem Implement a SortedList class which stores a list of int data in ascending order. Program requirements The public interface of your class is as follows: class SortedList{ public:...
3
by: kingflux | last post by:
Hello, and thank you in advance for any help you can provide. Each line in our datagrid control contains a product number, description, and a textbox for the user to enter a quantity-to-order. ...
20
by: technocraze | last post by:
Hi guys & commnunity experts, Does anyone knw how to go about checking for existing data in an MS Acess table? I have tried out the following code using vb but doesnt seem to work that well? Can...
7
by: Don Li | last post by:
Hi, Env is ms sql server 2000. ddl: create table srchPool(tid int primary key, taid int, s tynyint, uid tynyint); -- and sql server automatically creates a clustered index for the pk dml:
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.