15-12-17, 02:06 AM
Public Function GetMaid() As Integer
Dim x As Single = 1
If Conn.State = ConnectionState.Closed Then
Conn.Open()
End If
Dim adp As New OleDbCommand("select max (IDInvoices) from Invoices", Conn)
Try
x = adp.ExecuteScalar
Return x + 1
Catch ex As Exception
Return x
Conn.Close()
End Try
Dim x As Single = 1
If Conn.State = ConnectionState.Closed Then
Conn.Open()
End If
Dim adp As New OleDbCommand("select max (IDInvoices) from Invoices", Conn)
Try
x = adp.ExecuteScalar
Return x + 1
Catch ex As Exception
Return x
Conn.Close()
End Try