post1_database_project

Upload: joms-alancado

Post on 03-Mar-2016

215 views

Category:

Documents


0 download

DESCRIPTION

This Post is the procedure of making a C# windows application by connecting it to MySQL database, and automatically database.

TRANSCRIPT

PowerPoint Presentation

This program automatically loads database table to a listbox control and the selected value in listbox will appear in DataGridView.POST #1: By. Jomar P. AlancadoBSIT B-1Step 1. Open the Visual Studio 2012 or C# Application

Step 2. click new Project

Step 3. Select Visual C# and then select Windows Forms Application after that click ok

Edit the nameOf your project hereDatagridview1

Step 4.Create a form like this, drag the selected listBox to the form, and also The Datagridview from the ToolBoxListBox1You can edit the name of the lisbox and datagridview by selectingListbox or Datagridview and select properties

Step 5.Select the name of your project here, then select Add after that click Class.

Select Visual C# Items then select Class andName the class as DBConnect.cs after that click Add button below.

Step 6. this step is almost the to step 5 except the name of the class,Select the name of your project here, then select Add after that click Class.

Select Visual C# Items then select Class andName the class as ClassStudents.cs after that click Add button below.Step 7. Select Reference in solution Explorer and then select Add reference

Click browse then go to C:\Program Files (x86)\MySQL\Connector NET 6.7.4\Assemblies\v4.5If v4.5 didn't work choose v2.0 or v4.0 versionAfter that select the MySql.Data.dllAnd MySql.Data.Entity.dllStep 8. Go to Desktop and Open the MySQL Workbench application if you dont have then try to install the installer inside the folder of Automatic load database Then use password: admin when the installation is near to complete, after that open the MySQL Workbench application then click or open the Local instance then type the password: admin after that, go to managementThen select Data Import/Restore the follow theInstruction below.

Select thisClick thisThen go to the folder you download including this Power point and select the student_students.sql file then ok andClick button Start Import

Click thisStep 9. Heres the coding portion, go back to the Visual Studio 2012 Application and go to DBConnect.cs and insert this code.

Insert this codeStart coding here

Continue coding here

Continue coding hereStep 9. Go to your form1 or design double click the form and insert this code.

Insert thisStart coding here

Continue coding hereStep 10. F5 to run the program and the output is look like this.

Reference of the program:

Thank you I hope You learn a lot