我想增加一个号码。从sql它应该像这13-001但它使13-1这里是我的代码
Private Sub getLastID()
Dim dr As SqlDataReader
Dim Cmd As New SqlCommand
con.Open()
With Cmd
.Connection = con
.CommandText = "SELECT * FROM tbl_student ORDER BY Student_no DESC"
End With
dr = Cmd.ExecuteReader
If dr.Read Then
lblStudentNo.Text = Val(dr.Item(0)) + 1
End If
con.Close()
End Sub
我该怎么办?谢谢
答案 0 :(得分:1)