将列表项插入数据库 [英] Inserting List items to database
本文介绍了将列表项插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我是asp.net的新手,可以帮助我帮助我如何将列表项插入数据库..
谢谢
Hi all,
I am new to asp.net,Can help any body help me on how to insert list items to database..
Thanks
推荐答案
我不确定你的问题是什么 - 你在设计表时遇到问题吗? />
您无法直接在表格中存储列表项目。
您需要以标准化方式逐个存储选定的列表项目。
For例如如果你的清单是
I am not sure what your issue is - are you having a problem designing the table?
You cannot store list items in the table directly.
You need to store selected list items one by one in a 'normalized' manner.
For e.g. if your list is
A
B
C
你的桌子可能看起来像
Your table would probably look like
1 A
2 B
3 C
这里的数字是主键。
如果您在编写保存数据的代码时遇到问题,那么这个 [ ^ ]可能会对你有帮助。
Here the number is the primary key.
If you are just having a problem writing code to save data, then this[^] might help you.
我建议使用存储过程。
看看这里:
如何使用Visual Basic .NET在ASP.NET中调用SQL Server存储过程 [ ^ ]
如何to:创建和执行使用返回行的SQL语句 [ ^ ]
如何:执行返回行的存储过程 [ ^ ]
如何:执行返回单个值的存储过程 [ ^ ]
< a href =http://msdn.microsoft.com/en-us/library/ms171921.aspx>如何:执行不返回值的存储过程 [ ^ ]
如何:为命令目标设置和获取参数ts [ ^ ]
演练:使用存储过程显示数据GridView Web服务器控件 [ ^ ]
I would suggest to use stored procedure.
Have a look here:
How to call SQL Server stored procedures in ASP.NET by using Visual Basic .NET[^]
How to: Create and Execute an SQL Statement that Returns Rows[^]
How to: Execute a Stored Procedure that Returns Rows[^]
How to: Execute a Stored Procedure that Returns a Single Value[^]
How to: Execute a Stored Procedure that Returns No Value[^]
How to: Set and Get Parameters for Command Objects[^]
Walkthrough: Displaying Data Using a Stored Procedure in the GridView Web Server Control[^]
检查以下链接,了解如何使用通用列表集合进行批量插入。
如何有效地批量插入 [ ^ ]
http://ruijarimba.wordpress.com/ 2012/03/25 / bulk-insert-dot-net-applications-part1 / [ ^ ]
如何有效地批量插入 [ ^ ]
希望这可以帮助你...
Check the following links on how to Bulk Insert with Generic List collections.
How to bulk insert efficiently[^]
http://ruijarimba.wordpress.com/2012/03/25/bulk-insert-dot-net-applications-part1/[^]
How to bulk insert efficiently[^]
Hope this helps you...
这篇关于将列表项插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文