You mean you want to generate serial invoice numbers?
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
Private Sub AutoNumberNo()
Dim myReader As SqlDataReader
conn = GetConnect()
conn.Open()
Dim temp As String
Try
Dim sql As String = "SELECT MAX(NO) 'IDNumber' FROM Invoice "
Dim comm As SqlCommand = New SqlCommand(sql, conn)
myReader = comm.ExecuteReader
If myReader.HasRows Then
While myReader.Read()
temp = myReader.Item("IDNumber") + 1
End While
End If
myReader.Close()
Catch ex As Exception
End Try
conn.Close()
textboxId.Text = String.Concat(temp) ' result will appear in textboxID txtId
End Sub
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
this is not work properly ...please send clear code with database connection include
Simply call the subprocedure from the Button used for generating the sequence numbers like this:
Private Sub SerialButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SerialButton.Click
'Note: It is assumed that the button is named SerialButton
AutoNumberNo 'this calls this AutoNumberNo subprocedure
End Sub
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
I assumed you were using SQL Server but since you're not, you can make the changes to that of Access
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67