The Physician table has PhysicianPk as Int(11). I'm getting an System.InvalidCastException: Conversion from string "physicianPK" to type Integer is not invalid. Why does it think PhysicianPk is a string? I also tried all of the Int16,24,32,64 types.
Here is the code
Auguy
Sylvania/Toledo Ohio
Here is the code
Code:
Dim adapter As MySqlDataAdapter = New MySqlDataAdapter()
' Create the SelectCommand.
Dim command As MySqlCommand = New MySqlCommand( _
"SELECT * FROM Physician", connection)
' Create the UpdateCommand.
command = New MySqlCommand( _
"UPDATE Physician SET LastName = @LastName, FirstName = @FirstName " & _
"WHERE PhysicianPK = @oldPhysicianPK", connection)
Try
' Add the parameters for the UpdateCommand.
command.Parameters.Add("@PhysicianPK", MySqlDbType.Int24, "PhysicianPK")
command.Parameters.Add("@LastName", MySqlDbType.VarChar, 20, "LastName")
command.Parameters.Add("@FirstName", MySqlDbType.VarChar, 15, "FirstName")
Dim parameter As MySqlParameter = command.Parameters.Add( _
"@oldPhysicianPK", MySqlDbType.Int24, "PhysicianPK")
parameter.SourceVersion = DataRowVersion.Original
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Auguy
Sylvania/Toledo Ohio