我有一个ID
我在 asp.net vb 应用程序和 SQL Server 中创建的,其格式为MM/YYYY/##
# 是整数。随着用户生成表单,该整数在整个月内递增 1,因此目前它是08/2013/39
.
我用于此的代码如下
Dim get_end_rfa As String = get_RFA_number()
Dim pos As Integer = get_end_rfa.Trim().LastIndexOf("/") + 1
Dim rfa_number = get_end_rfa.Substring(pos)
Convert.ToInt32(rfa_number)
Dim change_rfa As Integer = rfa_number + 1
Dim rfa_date As String = Format(Now, "MM/yyyy")
Dim rfa As String = rfa_date + "/" + Convert.ToString(change_rfa)
RFA_number_box.Text = rfa
Public Function get_RFA_number() As String
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("AnalyticalNewConnectionString").ConnectionString)
conn.Open()
Dim cmd As New SqlCommand("select TOP 1 RFA_Number from New_Analysis_Data order by submitted_date desc", conn)
Dim RFA As String = (cmd.ExecuteScalar())
conn.Close()
Return RFA
End Function
我需要在每个月初将整数重置为 1。我该怎么做?