Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
'不重复编号上传用,这里的用法比较简单,没有做复杂的编号规则处理' Public Class BizCodeBuilder Private _codelock As New Object Public Sub New() End Sub Public Function GetNextCode(s_name As String, Optional s_prefix As String = Nothing) As String SyncLock _codelock '使用锁处理并发 Dim db = HySql.DataBaseFactory.CreateDatabase("编号用户测试库") Dim Sql As String = CExp("select * from uSysBizCode where BizName='{0}'", s_name) '执行SQL Dim dt As system.data.DataTable = db.ExecuteDataSet(Sql).Tables(0) Dim dr As system.data.DataRow If dt.Rows.count = 0 Then dr = dt.NewRow() dr("BizName") = s_name dr("MaxValue") = 1 If String.IsNullOrEmpty(s_prefix) Then s_prefix = Date.now.ToString("mmss") & "BH" dr("Prefix") = s_prefix dr("Mark") = "yyyyMMdd" 问题一:s_name 和s_prefix是 Public Function GetNextCode(s_name As String, Optional s_prefix As String = Nothing) As String中变量? 问题二: Dim Sql As String = CExp("select * from uSysBizCode where BizName='{0}'", s_name) ' 这个是动态查询,, s_name是自定义? 问题三:在数据库调试select * from uSysBizCode有数据,select * from uSysBizCode where BizName='{0}查询无数据均空 |