Ok, here is my code for my "LinkAdd" click. It does add a record. I'm
just trying to get back the record's autonumber at the same time I
append a row (simplified for the purpose of illustration).
Pushing "F1" when my cursor is inside of ".ExecuteScalar" gives me
help which says: "Executes the query, and returns the first column of
the first row in the resultset returned by the query. Extra columns
or rows are ignored." So, maybe it only works on Select queries, but
it DOES return the first row and first column:
Private Sub LinkSave_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles LinkSave.Click
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()
Dim intDanceID As Integer
intDanceID = CType(myCommand.ExecuteScalar(), Integer)
lblDanceID.Text = intDanceID-----Nothing happens here
myConnection.Close()
End Sub