This content has been marked as final. Show 2 replies
957535 wrote:Where are you associating the connection with the command? I don't see that in your code. The command object needs to be associated with a valid connection in order to execute a command.
OracleCommand cmd = new OracleCommand();
cmd.CommandText = "DELETE FROM MEMBERS23T WHERE ID=:pID";
cmd.Parameters.Add(new OracleParameter("pID", tbSearch.Text));
cmd.CommandType = CommandType.Text;
recordAffected = cmd.ExecuteNonQuery(); // Here throws the InvalidOperationException.