I tried what you suggested, the .ExecuteNonQuery and then
the .ExecuteScalar("SELECT @@Identity FROM myTable") and it worked.
I'm with you in thinking that it sure seems clunky. Any better ways
are welcomed to replace this:
Dim myConnection As New OleDbConnection
(fConnectionString)
Dim strSQL As String = "INSERT INTO tblDances
(AdminID) VALUES(1)"
Dim myCommand As New OleDbCommand(strSQL,
myConnection)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
strSQL = ""
strSQL = "SELECT @@Identity FROM tblDances"
Dim cmd As New OleDbCommand(strSQL, myConnection)
Dim intDanceID As Integer
intDanceID = CType(cmd.ExecuteScalar(), Integer)
lblDanceID.Text = intDanceID
myConnection.Close()