将listview数据保存到sql databse [英] save listview data to sql databse
问题描述
我正在使用c#.net&中的vs2008做我的项目(桌面应用程序) sql server2005,
我对表格&从文本框以相同的形式将数据添加到列表视图中,现在我想将列表视图dta保存到数据库中..
数据库过滤文本框是
商品说明,数量,费率,每笔,金额,总计.
列表视图数据应保存在该数据库的特定字段内....
请为其提供代码示例
在此先感谢
[edit]删除了SHOUTING,删除了紧急性,删除了textspeak,标记-OriginalGriff [/edit]
Hi ,
I am doing my project(desktop application) using vs2008 in c#.net & sql server2005,
i took a listview on my form & from textboxes on same form i added that data to listview ,now i want to save my listview dta to data base ..
database filds & textboxes are
description of goods,quantity,rate,per,amount,total.
the list view data should b save in this database within perticular fields....
Please provide me code sample for it
Thanks in advance
[edit]SHOUTING removed, urgency removed, textspeak removed, tags - OriginalGriff[/edit]
推荐答案
因此,实现的基础是您:
-创建连接: SqlConnection [ ^ ]并将其打开
-创建命令: SqlCommand [ SqlParameter [ SqlTransaction [ ExecuteNonQuery [ ^ ]执行该语句
-循环提交 [
So the basis of the implemenation is that you:
- create a connection: SqlConnection[^] and open it
- create a command: SqlCommand[^] and use bind variables in it: SqlParameter[^]
- start a transaction: SqlTransaction[^]
- now you loop through the list view and change the values of the parameters and use ExecuteNonQuery[^] to execute the statement
- after the loop commit [^]the changes
- close the connection and dispose the objects
以下是ADO.NET简介和绑定到ListBox教程的列表
1. ADO.Net简介[MSDN] [ ^ ]
2. 对ADO.NET的介绍 [服务器端ASP .NET数据绑定 [
Here are lists of Introduction to ADO.NET and Bind to ListBox Tutorial
1.Introduction to ADO.Net, [MSDN][^]
2.An introduction to ADO.NET[^]
3.Server-side ASP .NET Data Binding[^]
这篇关于将listview数据保存到sql databse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!