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

Copying DataRows from one table to other

SqlConnection sql;
SqlDataAdapter sqlda;
DataSet sqlds, msads;
OleDbConnection msa;
OleDbDataAdapter msada;
//DataRow drs,drm;
DataTable ab, abcopy;

private void Form1_Load(object sender, EventArgs e)
{
sql = new SqlConnection("data source=SRAVAN;user
id=sa;database=master");
sqlda = new SqlDataAdapter("Select * from addressbook",
sql);
sqlds = new DataSet();
sqlda.Fill(sqlds, "ab");
msa = new OleDbConnection("provider=microsoft.jet.oledb.
4.0;"
+ "data source=C:\\Documents and Settings\\sravan\\My
Documents\\AddressBook.mdb");
msada = new OleDbDataAdapter("select * from addressbook",
msa);
msads = new DataSet();
//msada.Fill(msads, "ab");
//string name, mobile, residence, notes,count;
}

private void button1_Click(object sender, EventArgs e)
{
/*drs = sqlds.Tables["ab"].NewRow();
drm = msads.Tables["ab"].NewRow();
for (int i = 0; i < sqlds.Tables["ab"].Rows.Count; i++)
{
drs = sqlds.Tables["ab"].Rows[i];
drm=drs;
msads.Tables["ab"].Rows.Add(drm);
msada.Update(msads, "ab");
}*/
ab = sqlds.Tables["ab"];
abcopy = ab.Clone();
for(int i=0;i<sqlds.Tables["ab"].Rows.Count;i++)
abcopy.ImportRow(ab.Rows[i]);
msada.Fill(abcopy);
msada.Update(abcopy);
}


this is code i had written..
please provide me the code to transfers the rows from one table in
[sql server 2000-->master-->addressbook] to other [MS Access-
>addressbook.mdb->addressbook(table_name)]
please provide the code for this..

Jun 7 '07 #1
0 1077

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

Similar topics

0
by: Uchiha Jax | last post by:
I have used this method many a time in previous applications without any hitches at all and i'm trying to use it in my current application and it isn't working. The only difference I can see is...
3
by: Prince | last post by:
hi all, I need to insert a datarows collection from a datatable into a datagrid?can anyone tell me how to do??? Thanx in advance..
5
by: Nathan Sokalski | last post by:
I am writing an ASP.NET application in which I need to copy DataRows from one DataTable to another. When I use code such as the following: temprows = nodes.Select("state='PA'")...
9
by: Brad | last post by:
I have written some code to manipulate data/records in a MASTER (order header) and DETAIL (order details) tables. What I have written is too extensive to post but essentially trying to: 1....
2
by: gl | last post by:
What is the quickest way to get an array of datarows (from a typed dataset) into a dataview (for the purpose of sorting to bind to a datagrid)? Like i have a function that returns...
3
by: creator_bob | last post by:
How do I create an array of datarows from a sorted list? I put a bunch of datarows into a sorted list to sort them. Then I got an array of the sorted elements. However, I cannot typecast them. ...
9
by: Nathan Sokalski | last post by:
I have a DataTable from which I only need a certain range of the DataRows. What I would like to do is copy a range of rows from one DataTable to a new DataTable like the following: For i As...
3
by: zhshqzyc | last post by:
remove other DataRows from your DataTable Hi, I want to display the top three rows of the table. So I just want to remove the other rows. Suppose the datas are not from a database. How to do...
8
by: jehugaleahsa | last post by:
Hello: We wrote an entire application where we add our DataRows to our DataTables immediately. However, we have to shut off our constraints to do this. We would like to use detached DataRows to...
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: 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: 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...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.