且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将表单字段插入数据库

更新时间:2022-01-22 02:56:07

您可以创建一个数据传输对象,该对象将是一个包含所有字段作为属性的类.您可以创建数据传输对象的列表,并在其中填充表单数据并发送.

如果数据量很大,则***使用存储过程来插入数据.对于存储过程,您可以将所有数据作为XML传递给存储过程,而不必使用准备语句,这比准备语句要快得多.

希望此建议对您有帮助.
You can create a Data Transfer Object, which will be a class with all your fields as properties. You can create a List of your Data Transfer Object fill it with your form data and send it.

You better use to a stored procedure to Insert your Data, if the Data Volume is big. In the case of Stored Procedure you can pass all your Data as XML to the Stored Procedure instead of using a Prepared Statement, which will be much faster than a Prepared Statement.

Hope this advice helps.