使用c#将数据导入db [英] Import data to db with c#

查看:87
本文介绍了使用c#将数据导入db的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在现有表格中导入新数据表单。表格相同,

例如


表1

ID | FirstName |姓氏


表2

ID | FirstName |姓氏


只有数据不同。


我怎么能这样做?


一些示例可能非常有用


谢谢

How I can import new data form table in existing one. The tables are same,
for e.g.

Table 1
ID | FirstName | Last Name

Table 2
ID | FirstName | Last Name

Only data are different.

How I can do that?

Some example can be very useful

Thanks

推荐答案



是你可以,例如你必须提供更多的细节,你使用什么数据库,b
使用,桌子在哪里等等。


在最坏的情况下escenario你可以在表中迭代插入和/ / $
在另一个表中插入每一行:


foreach(table1中的DataRow行)

{

DataRow newrow = table2.NewRow();

newrow [" ID"] = row [" ID"];

table2.Rows.Add(newrow);

}

欢呼,


-

Ignacio Machin,

ignacio.machin at dot.state.fl.us

佛罗里达州交通局

华盛顿 < AB ****** @ yahoo.com>写在消息

新闻:Op ************** @ TK2MSFTNGP11.phx.gbl ...
Hi,
Yes you can, for examples you have to give more details, what db are you
using, where are the tables, etc.

In the worst case escenario you can iterate in the table to be inserted and
insert each row in the other table:

foreach( DataRow row in table1 )
{
DataRow newrow = table2.NewRow();
newrow["ID"] = row["ID"];
table2.Rows.Add( newrow );
}
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Washington" <ab******@yahoo.com> wrote in message
news:Op**************@TK2MSFTNGP11.phx.gbl...
我如何导入新的现有数据表格。表格相同,例如

表1
ID | FirstName |姓氏

表2
ID | FirstName |姓氏

只有数据不同。

我怎么能这样做?

一些例子非常有用

>谢谢
How I can import new data form table in existing one. The tables are same,
for e.g.

Table 1
ID | FirstName | Last Name

Table 2
ID | FirstName | Last Name

Only data are different.

How I can do that?

Some example can be very useful

Thanks



在SQL中选择表格语法,你可以试试


Shivprasad Koirala

C#,VB.NET,SQL SERVER,ASP.NET访谈问题
http://www.geocities.com/dotnetinterviews/

Select into table syntax in SQL , you can try that

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/


我正在使用MS Access和VS 2003与c#


我想在下载新版本后更新MS Access DB。


Ignacio Machin(.NET / C#MVP)" < ignacio.machin AT dot.state.fl.us>在消息新闻中写了

:e
I am using MS Access and VS 2003 with c#

I would like to make update of MS Access DB after new version is downloaded.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:e


这篇关于使用c#将数据导入db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆