Hi every one!!
I have a java program and i don't know how to delete a record from an array of objects using JOptionPane

i dont know this may help you or not but i had used this method to delete a record from a database using JOptionPane

example

int reply = JOptionPane.showConfirmDialog (this, 
				"Do you really want to Delete\nthe " + txtMemberName.getText () + " Record?",
				"LibrarySystem - Delete Member", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE);

				//Check the User Selection.
				if (reply == JOptionPane.YES_OPTION) {			//If User's Choice Yes then.

					try {	//DELETE Query to Delete the Record from Table.
						String q = "DELETE FROM Members WHERE id = " + id + "";
						txtClear ();				//Clearing the TextFields.
						JOptionPane.showMessageDialog (this, "Record has been Deleted.");
						ResultSet rs = st.executeQuery (q);	//Executing the Query.
					}
					catch (SQLException sqlex) {System.out.println("problem"); }

You can use DeadSoul's code, but instead of the SQL query from line 8 onwards, remove the object from your array. I strongly recommend that you replace the array with an ArrayList which will greatly simplify your code for adding and removing records (use its add(...) and remove(...) methods) as well as eliminating all problems with array sizing/resizing.

hi everyone!
Thx for the java thread!!
it's cool.
i'm stuck with an ASP.Net code - don't know how to create a login page that will check username and password from a database.
Please help me.

no, we're not going to do that.
For one you're asking something that simply going through the jdbc and jee tutorials would teach you, and then again you're hijacking your own thread here.

This article has been dead for over six months. Start a new discussion instead.