如何在asp.net中移动记录 [英] how to move records in asp.net

查看:67
本文介绍了如何在asp.net中移动记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果表格达到100条记录,如何将记录移动到另一个表格

------------------------- ---------------------------------------------



亲爱的朋友们,



我正在使用asp.net c#,SqlServer 2005.



我创建了一个webapplication,在这个webapplication中,我有一个带有网格视图的网页,带有页脚文本框来输入记录。如果此gridview达到100条记录,则必须将最后50条记录移动到另一个表。



在数据库中,我有2个表TableA和TableB ....如果TableA到达最近50条记录的100条记录必须转移到表格B.



请帮您解决这个问题?



提前谢谢。

解决方案

我问为什么。这样做需要有一个非常好的商业理由,因为如果它仅由数据网格中的行数驱动,那么你构建的是一个噩梦而不是应用程序。


你可以检查添加记录时tableA中的记录数。如果该数字大于或等于100,则以desc形式从tableA获取记录并获得前50名。您可以将它们添加到通用列表< type of =class =to =hold = object =tablea =>并插入表格B.



然后你可以删除tableA中的记录。



第二种方式是在sql查询的帮助下。查看这些链接了解详情。

http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table- insert-into-select-select-into-table



http://blog.sqlauthority.com/2012/10/31/sql-server-copy-data -from-one-table-to-another-table-sql-in-sixty-seconds-031-video



谢谢,

Jagjot

How to move records to another table, if the table reaches 100 records
----------------------------------------------------------------------

Dear Frnds,

am working on asp.net c#, SqlServer 2005.

I have created a webapplication, In this webapplication i have webpage with gridview with footer textboxes to enter the records. If this gridview reaches 100 records, last 50 records must be moved to another table.

In database i have 2 tables TableA and TableB....if the TableA reaches 100 records last 50 records must move to TableB.

Please can you help me how to do this ?

Thanks in advance.

解决方案

I have ask WHY. There needs to be a very good business reason to do this because if it is driven solely by the number of rows in your datagrid then you are building a nightmare not an application.


you can check count of records in tableA at the time of adding records. If that number is greater than or equal to 100 then get the records from tableA in desc form and get top 50. You can add them to a generic list<type of="" class="" to="" hold="" object="" tablea=""> and insert into tableB.

Then you can delete records from tableA.

Second way to do that is with the help of sql query. check these links for details.
http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table

http://blog.sqlauthority.com/2012/10/31/sql-server-copy-data-from-one-table-to-another-table-sql-in-sixty-seconds-031-video

Thanks,
Jagjot


这篇关于如何在asp.net中移动记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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