請問各位高手
小弟需要判斷欄位是否有值
如果有值編號就自動+1上去
但最後到10就會停住
上不去了
請各位高手幫忙提點一下問題出在哪裡,謝謝大家。
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim dt As DataTable = New DataTable()
Dim text As String = ""
Using CONN1 As SqlConnection = New SqlConnection()
CONN1.ConnectionString = ""
Dim sql1 As String
sql1 = "(SELECT Convert(varchar(6),Getdate(),112)+ isnull( replicate('0',( 2-len( convert(varchar(24),(MAX(RIGHT([D0101],2))+1))) )) + convert(char(2),(MAX(RIGHT([D0101],2))+1)),'01') from [QA8D01] where left([D0101],6) = '" & DateTime.Now.ToString("yyyyMM") & "')"
Dim adapter As SqlDataAdapter = New SqlDataAdapter(sql1, CONN1)
adapter.Fill(dt)
If dt.Rows.Count = 1 Then
text = dt.Rows(0)(0).ToString()
End If
End Using
ID1.Text = text
End Sub