I have already created an MS Access database to store a list of users with the following details:- First Name, Last Name, Address, Home Tel No, Mobile No and E-mail Add.
Now i need all the names to be read into an array of structures and the names should be displayed when the form is loaded. When the name is highlighted, all the details of that user should apprear at the bottom of the screen.
There are also 4 other options needed;
Add new user - update the Access database with the relevant details and display a welcome message.
Delete user - delete the user from the database after displaying a delete confirmation message.
Update user - select the user name and click update button to amend the details.
Total users - calculate the total number of users in the database and display the top 10 users according to last names in alphabetical order.
Anyone kind enough to provide a source code for the following or have a similar program's source code?? I need some help badly...
Here is some source code which tries to solve the Othello game using a depth first search (not realistic). There is a class called DBWriter which is probably the type of thing that you are looking for. I'm sure there are better classes out there, but this should hopefully get you started.
Only you know what "doesn't seem to work" means...
Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
A simple one-table database application. I have modified it so it
deals with your table. The database is MySQL, so you will have to
change the database connection parameters. And it has a qouple of quirks left.... you are cordially invited to find
them, understand them and fix them.
PS: you may want to remove the package directive on top of the src files.
try
{
Class.forName(driver);
Connection connection=DriverManager.getConnection(url);
Statement querylibrary=connection.createStatement();
int result = querylibrary.executeUpdate(theStatement);
int result2 = querylibrary.executeUpdate(theStatement2);
if ( result == 1 ){
System.out.print( "\nOrder Placed\n" );
JOptionPane.showMessageDialog (this, "Record has been Saved.");
jTextFieldID.setText(null);}
else{
System.out.print( "\nInsertion failed\n" );
JOptionPane.showMessageDialog (this, "Problem while Saving the Record.");}