Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

C# Windows Forms Database Connectivity, Reading Data

Topics: Database Connectivity, Reading Data

You will create an C# Windows Form that can connect to the exampleDatabase on a MySql server.  The connection string should be dynamic using the IP address in the connect.txt file you created on your C:\ drive.  It will use dbsAdmin as the user ID and password as the password for that user account.  Make sure this user account exists on your MySQL server and has appropriate access to the database.  You will be required to have a try...catch to ensure that the application does not crash if it cannot connect to the MySql server.  The connection string should work when the application is run on the instructor’s computer without having to change any code.

You can start with the code from the code examples, but you will be required to add some significant functionality.  You can select the table and columns you wish to draw from in your application, but the SQL statement should return a recordset with at least 10 but not more than 25 records of at least 4 columns.  You must select the columns within the SELECT statement and not use the * wildcard to return them all.

Once you have loaded the data, you will use the data from the first record to populate user input controls on the form.  This will require you to know what data is being cached because you will select your controls based on that data.  So, if the data is a number, you should convert it to a number and populate a number control with that data.  Do not use only textboxes to show the data.  Therefore, your recordset must include more than just string data.

Your form should have the following additional functionality:

  • The user must be able to move forward and backward through the recordset

  • The user should have the ability to jump to the first or last record of the recordset.

  • A control must show which record you are currently on as well as the total number of records (such as “record X of XX” and this should be record number as human-counted, not index number)

  • There must be a mechanism to keep the user from moving beyond the first or last record

The Main form should have a File menu that contains the following commands: Save and Exit.  The Save command should allow the user to save the current data from the user input controls to a file of their choosing, and the Exit command should close the application.  Each menu command should also have keyboard shortcuts for each command: Save -> CTRL+S, Exit->CTRL+Q.

These are the guidelines used by the grading rubric:

Database Connectivity

  • The application should connect to a MySql database with a programmatically created connection string

  • The application verifies with a try...catch server connectivity.

  • Only the data needed is pulled from the database.

  • The first record’s data is loaded into controls on the form.

User Input Controls

  • A button exists that moves forward through each record of the data.

  • A button exists that moves backward through each record of the data.

  • A button exists that jumps to the first record of the recordset.

  • A button exists that jumps to the last record of the recordset.

  • A control exists to show which record the user on and the total number of records.

Main Form

  • MenuStrip is used for commands.

  • Two commands exist on the File menu: Save, Exit.

  • Each command on the File menu has a corresponding keyboard shortcut.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question