Yes, thank you for that, but what I'm trying to accomplish it to be in the DALBase Class. I want to have a public function that returns the value of the newly added autonumber using MS Access as the back end database.
This is my sample code that I want it to be part of the DALBase Class that was discussed and used in the book (author by: Theoron Willis, is it you who replied to me above?)
Dim conn As New OledbConnection("Provider=Microsoft.Jet.OLEDB.4.0; ....")
Dim sql As String = "INSERT INTO tablename( FieldName ) " & _
Dim cmd As New OleDbCommand(sql, conn)
Dim i As Integer = cmd.ExecuteNonQuery()
cmd.CommandText = "SELECT @@IDENTITY"
Dim id As Integer = cmd.ExecuteScalar()
MessageBox.Show("Newly added ID: " & id.ToString())
If It will be encapsulated as a public function in the DALBase Class, it would be great. But how can I do that? Is it possible??? Can you help me?..... Thanks