需要帮助创建公司代码 [英] need help in creating company code

查看:68
本文介绍了需要帮助创建公司代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请帮我创建以下格式的公司代码



公司名称:xyzabc纺织品

代码:xyza0001



i编写了以下查询来获取子字符串

Hi all

Please help me creating company code in below format

Company Name: xyzabc textile
code : xyza0001

i wrote the below query to get the substring

SELECT CompanyName, SUBSTRING (CompanyName, 0, 5) as substring_name
FROM Company
ORDER BY 1





但是没有得到如何使用查询添加计数器并导致vb.net中的代码。



请给出一些建议......



But not getting how to add the counter with the query and result out the code in vb.net.

Please give some suggestion...

推荐答案

你可以有一个单独的表来存储下一个要使用的companyNumber。然后将其附加到字符串的末尾。如果在插入记录时在SQL中执行此操作,则会阻止多个客户端获得相同的数字。



每次InsertCompany语句运行时,您都会读取当前数字,将它附加到您要使用的代码值并将数字增加一个。
You could have a separate table that stores the next companyNumber to use. then append that to the end of the string. If you did this in SQL when you insert the record it would prevent multiple clients getting the same number.

Each time the InsertCompany statement runs, you read the current number, append it to the code value you want to use and increment the number by one.


这篇关于需要帮助创建公司代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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