在异步页面中一个接一个地插入多个记录 [英] Inserting Multiple record one after other in Asynchronous Page

查看:58
本文介绍了在异步页面中一个接一个地插入多个记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在此先感谢,

我正在创建一个Web应用程序,我需要在数据库中插入一个语句列表,该列表将来自数据表.

这些文件可能包含50-200条记录

我需要一种对数据库中每行插入的响应都返回给客户端的方法.如成功或失败.
如果一行失败,我将返回.

我不想执行所有插入,然后返回结果摘要.

我需要有关如何执行此操作的想法.如果提供代码,那就更好了.

应该在异步页面中完成.

谢谢你.最好的问候!!!
Siva

Hi all,

Thanks in Advance,

I''m creating a web application and i need to insert a list of statements into the database, the list will come from a datatable.

These files may contain 50-200 records

I need a way to give a response back to the client for every row insertion to the database. Such as successful or failed.
if a row is failed i''v to return back.

I don''t want to execute all INSERTS and then return the summary of results.

I need the idea on how to do this. Its better if you provide the code.

should be done in Asynchronous Page.

Thank you. Best Regards!!!
Siva

推荐答案

在这种情况下,我将使用AJAX.带外插入数据库将异步完成,您可以在不刷新页面的情况下向客户端提供更新的状态.

如果需要代码,可以使用大量的AJAX示例.
For this scenario I would use AJAX. Being out of band the database inserts would be done asynchronously and you could provide updated status to the client without refreshing the page.

If you want code, there are a plethora of AJAX examples available.


您可以填充列表并使用foreach插入数据库中,还可以使用try catch来处理错误! /> 例如,在catch中,您可以从头开始填充,我们可以中断该过程.
you can populate a list and use foreach to insert in database, and you can use try catch to handle errors!
for example in catch you can start populating from the start, our you can break the process.


这篇关于在异步页面中一个接一个地插入多个记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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