使用Webform写入数据库 [英] Write to database using webform

查看:73
本文介绍了使用Webform写入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用c#和一个实体关系层将其写入数据库.

我想多次在文本框中向数据库中的表写入值.


金额可以在网络表单中指定.

例如
txtbox1 =插入产品代码555
txtbox2 =我想在表中插入产品代码555的次数.
btnCLick =根据txtbox2特定时间写入产品代码

该表具有以下字段:
StockID,ProductID
stockID-自动递增,因此,如果我编写ProductID,它将分配一个库存ID.

我想知道如何在一次交易中将10个(可以是任何值)productID写入库存表.


任何建议将不胜感激!

JC

Hi,

I am using c# and an entity relationship layer to write to my database.

I would like to write a value in a text box to a table in my database multiple times.


The amount can be specified in the webform.

e.g.
txtbox1= insert product code 555
txtbox2 = the amount of times I want to insert product code 555 to the table.
btnCLick= Writes the product code a specific amount of times dependent on txtbox2

The table has the following fields:
StockID,ProductID
stockID - Auto increment So if I write ProductID it will assign a stock ID.

I want to know how to write 10(this can be any value) productIDs to the stock table in one transaction.


Any advice would be much appreciated!

JC

推荐答案

一种方法是将值作为数组传递给存储过程.这是执行此操作的一种方法:
One way is to pass the values to a stored procedure as an a array. Here is one way to do this: Passing an Array of Values to a Stored Procedure in SQL Server 2005[^].

If you follow up on this link you should find plenty of other examples.


这是您第三次问这个问题.您已经收到了对先前两个问题的良好答案,现在,这个答案甚至还有另一个很好的答案.请看看那些.如果您还有与上一个问题直接相关的其他问题,请使用改善问题"链接并更新现有问题,以确保您的问题的上下文不会丢失.
干杯.
This is the 3rd time you have asked this question. You have received good answers to both of your previous ones and now this one has even another good answer. Please look at those. If you have further questions directly related to a previous one, use the "Improve Question" link and update an existing question so the context of your question doesn''t get lost.
Cheers.


这篇关于使用Webform写入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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