I'm having trouble retrieving the UserPK auto incrementing Identity back from MySql during the insert. I've tried a couple of things, but it confuses me and didn't work. Here is my Insert code
What is the proper way to get the PK back from MySql without issuing a separate command?
Auguy
Sylvania/Toledo Ohio
Code:
' Create the InsertCommand.
command = New MySqlCommand( _
"INSERT INTO UserID (UserID, FirstName, LastName, AllowLogin, UserPswrd " _
& ", Notes, EditCount, IsActive)" _
& " VALUES (@UserID, @FirstName, @LastName, @AllowLogin, @UserPswrd " _
& ", @Notes, @EditCount, @IsActive)", connection)
' Add the parameters for the InsertCommand.
command.Parameters.Add("@UserID", MySqlDbType.VarChar, 10, "UserID")
command.Parameters.Add("@FirstName", MySqlDbType.VarChar, 15, "FirstName")
command.Parameters.Add("@LastName", MySqlDbType.VarChar, 20, "LastName")
command.Parameters.Add("@AllowLogin", MySqlDbType.Int24, 11, "AllowLogin")
command.Parameters.Add("@UserPswrd", MySqlDbType.VarChar, 47, "UserPswrd")
command.Parameters.Add("@Notes", MySqlDbType.VarChar, 500, "Notes")
command.Parameters.Add("@EditCount", MySqlDbType.Int24, 11, "EditCount")
command.Parameters.Add("@IsActive", MySqlDbType.Int16, 4, "IsActive")
adapter.InsertCommand = command
Auguy
Sylvania/Toledo Ohio