在C#WPF中将所有datagrid值一次保存到数据库中 [英] Save all datagrid value into a database at once in C# WPF

查看:68
本文介绍了在C#WPF中将所有datagrid值一次保存到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据网格,它是由各种动作和用户对数据的操纵创建的。我想立即将网格的所有数据插入数据库

I have a datagrid which is created by various action and user's manipulation of data. I want to insert all the data of the grid to the database at once

推荐答案

您需要将数据转换为xml,您可以使用OPENXML插入所有数据立即到桌子。这是一篇很好的文章





[ ^ ]



但是你要加载多少数据一次,因为如果你正在使用WPF应用程序它是一个Windows应用程序,当所有数据一次加载时,你的系统可能会抛出内存异常。这因系统而异,因为每个系统都有不同的配置。所以最好为Windows应用程序加载数据块。
You need to convert the data to xml and you can use OPENXML to insert all the data to the table at once. Here is an nice article about that


[^]

But becareful about how much data you are loading at once because if you are working on WPF application it's a windows application when all the data is loaded at once your system may throw out of memory exception. This defers from system to system as each system will have different configurations. so it's better to load data in chunks for Windows applications.


这篇关于在C#WPF中将所有datagrid值一次保存到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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