如何创建一个自动生成自定义代码的函数 [英] how to create a Function to auto generate custom code

查看:72
本文介绍了如何创建一个自动生成自定义代码的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我为发票创建了一个asp.net页面,

我必须在之前生成发票#插入。



例如,创建发票形式:

折叠|复制代码

日期:__________发票#10012



项目:__________说明:__________数量:__________备注:__________



'保存'





每张新发票,我必须自动递增'发票# 。

怎么做,



plzzz帮助/建议我。



谢谢。

Hi guys,

I have created one asp.net page for invoice,
where i have to generate invoice no# before insertion.

for eg, creating invoice form:
Collapse | Copy Code
Date:__________ Invoice# 10012

Item:__________ Description:__________ Qty:__________Remarks:__________

'Save'


on every new invoice, i have to auto increment the 'invoice#'.
how to do that,

plzzz help/suggest me.

thanks.

推荐答案

解决方案:



为此你需要有一个像'TblInvoice'这样的表,在这里你可以有几列你可以保存不同的值(如果你想)和'InvoiceNumber'.table架构:



创建表TblInvoice



InvoiceNo int相同(1,1)主键





In这将自动增加发票号码。现在你可以在每个记录插页上增加o。
Solution:

For this you need to have a table like 'TblInvoice', in this you can have few columns where you can save different values(if you want ) along with 'InvoiceNumber'.table architecture:

Create Table TblInvoice
(
InvoiceNo int identical(1,1) primary key
)

In this you will automatically have increment in invoice no. Now you can get incremented o on every record insert.


请不要重新发布。



如果您想安全地自动增加发票号,那么请使用SQL的自动增量功能 - 根据您之前的问题发布。



如果在输入任何数据之前需要发票号码(为什么???),则在加载页面时插入一个虚拟行(以获取数字)和当您有要保存的详细信息时更新行。这对于您网站的多个用户来说足够强大
Please don't repost.

If you want to safely auto-increment an invoice number then use the autoincrement feature of SQL - as posted against your previous question.

If you need the invoice number before any data is entered (why???) then insert a dummy row when the page is loaded (to get the number) and update the row when you have the details to save. This will be robust enough for multiple users of your site


这篇关于如何创建一个自动生成自定义代码的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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