我想为我的项目在表中使用c#和tsql进行演绎 [英] i want to do deductions in table using c# and tsql for my project

查看:53
本文介绍了我想为我的项目在表中使用c#和tsql进行演绎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个项目,我必须向所有用户提供6双鞋子.我已经创建了一个用于分发鞋子的表格,每当赠送1双鞋子时,就应该在数据库中以及前端进行推导,请帮助"h2_lin">解决方案

如果您想将SQL表中的值减少1,您可以这样做:

  UPDATE  myTable
 SET  shoeCount = shoeCount- 1 
位置 id = {鞋子的ID} 


如果要基于前端更新值,则需要将其作为参数传递,如下所示:

  UPDATE  myTable
 SET  shoeCount =  @ newCount 
位置 id = {鞋子的ID} 


该参数将需要从前端的值中填充.您可以将此T-SQL放入存储过程中,然后可以从前端调用该存储过程.


hi i have a project in which i have to give 6 shoes to all users i have created a form for distributing shoes whenever 1 shoes is given then deduction should be on database as well as in front end please help

解决方案

If you want to reduce the value in your SQL table by one, you would do so like this:

UPDATE myTable
SET shoeCount = shoeCount - 1
WHERE id = {the shoe ID}


If you wanted to update the value based upon what was in the front end, you would need to pass that in as a parameter like so:

UPDATE myTable
SET shoeCount = @newCount
WHERE id = {the shoe ID}


The parameter would need to be populated from the value in your front end. You could make this T-SQL into a Stored Procedure that you could call from your front end.


这篇关于我想为我的项目在表中使用c#和tsql进行演绎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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