Vb.net在SQl中插入多行 [英] Vb.net Inserting Multiple Rows into SQl

查看:101
本文介绍了Vb.net在SQl中插入多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看起来像这样的datagridview视图

I have a datagridview view that looks like this

SeriaId |产品名称|型号|制造商

SeriaId | ProductName | Model | Manufatcurer

datagridview以所有单元格为空开头.(或者还有其他可以代替网格视图使用的东西吗?)用户将在每列中输入数据.用户输入的行数更改(未知).用户只能输入一种或五种产品 产品.

The datagridview starts with all cells empty.(or is there something else i can use instead of grid view?) The user will enter data in each of the columns. The number of rows the user enters changes(is unknown). The user could enter only one product or five products.

因此,一旦用户输入了他必须输入的所有产品,我希望当他单击按钮时,所有产品都将保存到数据库中.还应检查是否有正确的详细信息,如果可能,应使用存储过程. 更好

So, once the user has entered all the products he has to enter, i want that when he clicks a button, all products will be saved to the database. A check should also be performed for correct details, and if its possible, the use of stored procedures would be better

sql数据库中的表看起来像datagrid,而我处于sql 2005环境中.

The table in the sql database looks like the datagrid, and i am in a sql 2005 enviroment.

由于用户输入的产品数量未知,我如何将数据保存到数据库?

As the number of products that the user will enter is unknown, how can i save the data to the database?

谢谢...

推荐答案

我认为您仍然可以使用数据绑定来完成此任务.如果您希望DataGridView在开始时为空,只需确保SQL SELECT语句不返回任何数据即可.

I think you can still use data binding to accomplish this task. Just make sure that the SQL SELECT statement does not return any data if you want the DataGridView to be empty at the start.

http://msdn.microsoft.com/en-us/library/fbk67b6z.aspx


这篇关于Vb.net在SQl中插入多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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