Public Function KeyStore() As String
Dim intNum, strSQL As String
Dim sqlCon As New SqlConnection(con)
'strSQL = "SELECT COUNT(*) FROM Store"
strSQL = "SELECT MAX(storeID) AS storeID FROM Store"
Dim cmd As New SqlCommand(strSQL, sqlCon)
sqlCon.Open()
intNum = cmd.ExecuteScalar()
intNum += 1
If intNum <= 9 Then
intNum = "ST" & "0" & intNum
ElseIf intNum > 9 Then
intNum = "ST" & intNum
End If
sqlCon.Close()
Return intNum
End Function
Public Function KeyStore() As String
Dim intNum, strSQL As String
Dim sqlCon As New SqlConnection(con)
'strSQL = "SELECT COUNT(*) FROM Store"
strSQL = "SELECT replace(max(storeID),'ST','') AS storeID FROM Store"
Dim cmd As New SqlCommand(strSQL, sqlCon)
sqlCon.Open()
intNum = cmd.ExecuteScalar()
intNum += 1
If intNum <= 9 Then
intNum = "ST" & "0" & intNum
ElseIf intNum > 9 Then
intNum = "ST" & intNum
End If
sqlCon.Close()
Return intNum
End Function
Public Function KeyStore() As String
Dim intNum, strSQL As String
Dim sqlCon As New SqlConnection(con)
strSQL = "SELECT MAX(storeID) AS storeID FROM Store"
Dim cmd As New SqlCommand(strSQL, sqlCon)
sqlCon.Open()
intNum = cmd.ExecuteScalar()
sqlCon.Close()
Return intNum
End Function