Last time PSP

Source: Internet
Author: User

Psp:

First, the plan

It takes about five days to complete this task.

Second, the development

1. Demand Analysis:

As a volleyball field worker, I need to count each player's score and technical statistics (e.g. serve, block, pass, etc.) in order to award the MVP of each game and determine the best lineup.

2. Create the design document:

(1) Through the field staff interface, when the athlete scores, through the DataGridView control to add or update data, and immediately update to the database, and then through the Query button to enter the game after the end of the athlete's total score and technical statistics interface.

(2) Be able to get the score of serve, Spike, block in the database, as well as the success number of a setter, and the number of successful defenders, and then sort in descending order, get the first data of the first row, the name of the player with the highest score into the text box, to obtain the MVP.

Then get the best serve, spike, block, one pass, two pass, free man, realize in the text box.

(3) Activity diagram

3. Design Review

The same group of personnel review, discussed the feasibility and not feasible place, modified some functions.

4. Code specification

There are some reasonable requirements for the current content to be developed.

5. Specific design

6. Specific code

Using System.Data.OleDb;
Namespace staff Statistics
{
public partial class Form1:form
{
Public Form1 ()
{
InitializeComponent ();
}
OleDbConnection conn;//declares a OleDbConnection variable
OleDbDataAdapter adapter;//declares a oledbadapter
DataSet ds = null;

private void Form1_Load (object sender, EventArgs e)
{
TODO: This line of code loads the data into the table "tab Dataset.allathlete". You can move or delete it as needed.
This.allathleteTableAdapter1.Fill (this. statistical table Dataset.allathlete);
TODO: This line of code loads the data into the table "Workersdataset1.allathlete". You can move or delete it as needed.
This.allathleteTableAdapter.Fill (This.workersDataSet1.Allathlete);
TODO: This line of code loads the data into the table "workers." Allathletes "in. You can move or delete it as needed.

//
conn = new OleDbConnection (@ "Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\users\administrator\desktop\ statistics. mdb") ;
adapter = new OleDbDataAdapter ("SELECT * from Allathlete", conn);
ds = new DataSet ();
Adapter. Fill (ds, "Allathlete");
Datagridview1.datasource = ds. Tables[0];
Datagridview1.rowheadersvisible = false;

}

private void Button1_Click (object sender, EventArgs e)
{
//connection database
conn = new OleDbConnection (@ "provider= Microsoft.jet.oledb.4.0;data source=c:\users\administrator\desktop\ statistics. mdb ");
Adapter = new OleDbDataAdapter ("SELECT * from Allathlete", conn);
ds = new DataSet ();
Adapter. Fill (ds, "Allathlete");
Datagridview1.datasource = ds. Tables[0];
Datagridview1.rowheadersvisible = false;

//method for creating a DataTable type

}
Private DataTable Dbcon (string stroledb)
{
Conn. Open ();
This.adapter = new OleDbDataAdapter (stroledb,conn);
DataTable dtselect = new DataTable ();
int rnt = This.adapter.Fill (Dtselect);
Conn. Close ();
return dtselect;
}

private void Button2_Click (object sender, EventArgs e)
{
if (Dbupdate ())
{
MessageBox.Show ("Update succeeded");
}
}
Private Boolean dbupdate ()
{
String stroledb = "SELECT * from Allathlete";
DataTable dtupdate = new DataTable ();
Dtupdate = This.dbcon (stroledb);
DtUpdate.Rows.Clear ();
DataTable dtshow = new DataTable ();
Dtshow = (DataTable) This.dataGridView1.DataSource;
for (int i = 0; i < DtShow.Rows.Count; i++)//Loop traversal
{
Dtupdate.importrow (Dtshow.rows[i]);

}
Try
{
This.conn.Open ();
OleDbCommandBuilder cb = new OleDbCommandBuilder (this.adapter);
This.adapter.Update (dtupdate);
This.conn.Close ();
}
catch (Exception ex)
{
MessageBox.Show (ex. Message.tostring ());
return false;
}
Dtupdate.acceptchanges ();
return true;
}

private void Button3_Click (object sender, EventArgs e)
{
Form2 a = new Form2 ();
A.show ();
This. Hide ();
}


}
}

Using System.Data.OleDb;

Namespace staff Statistics
{
public partial class Form2:form
{
Public Form2 ()
{
InitializeComponent ();
}

private void Form2_load (object sender, EventArgs e)
{
TODO: This line of code loads the data into the table "tab Dataset3.allathlete". You can move or delete it as needed.
This.allathleteTableAdapter3.Fill (this. statistical table Dataset3.allathlete);
TODO: This line of code loads the data into the table "tab Dataset2.allathlete". You can move or delete it as needed.
This.allathleteTableAdapter2.Fill (this. statistical table Dataset2.allathlete);
TODO: This line of code loads the data into the table "tab Dataset1.allathlete". You can move or delete it as needed.
This.allathleteTableAdapter1.Fill (this. statistical table Dataset1.allathlete);
TODO: This line of code loads the data into the table "worker." Allathlete "in. You can move or delete it as needed.
This.allathleteTableAdapter.Fill (This.worker.Allathlete);


}

private void Button3_Click (object sender, EventArgs e)
{
String conn = @ "Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\users\administrator\desktop\ statistics. mdb";
OleDbConnection con = new OleDbConnection (conn);
String sql = "Select Qiuyuan from Allathletes ORDER by Faqiu Desc";
Con. Open ();
String sql = "Select Qiuyuan from Allathlete ORDER by Faqiu Desc";
OleDbCommand cmd = new OleDbCommand (Sql,con);
OleDbDataReader reader = cmd. ExecuteReader ();
Try
{
Reader. Read ();
String Faqiu = (string) reader[0]. ToString ();
TextBox1.Text = Faqiu;
Reader. Close ();
Con. Close ();
Con. Open ();
String SQA = "Select Qiuyuan from Allathlete ORDER by Kouqiu Desc";
OleDbCommand CMA = new OleDbCommand (SQA, con);
OleDbDataReader Readera = CMA. ExecuteReader ();
Readera. Read ();
String Kouqiu = (string) readera[0]. ToString ();
TextBox2.Text = Kouqiu;
Readera. Close ();
Con. Close ();
Con. Open ();
String sqb = "Select Qiuyuan from Allathlete ORDER by Lanwang Desc";
OleDbCommand CMB = new OleDbCommand (SQB, con);
OleDbDataReader Readerb = CMB. ExecuteReader ();
Readerb. Read ();
String Lanwang = (string) readerb[0]. ToString ();
TextBox3.Text = Lanwang;
Readerb. Close ();
Con. Close ();
Con. Open ();
String SQC = "Select Qiuyuan from Allathlete ORDER by Yichuan Desc";
OleDbCommand CMC = new OleDbCommand (SQC, con);
OleDbDataReader READERC = CMC. ExecuteReader ();
Readerc. Read ();
String Yichuan = (string) readerc[0]. ToString ();
Textbox4.text = Yichuan;
Readerc. Close ();
Con. Close ();
Con. Open ();
String sqd = "Select Qiuyuan from Allathlete ORDER by Erchuan Desc";
OleDbCommand CME = new OleDbCommand (Sqd, con);
OleDbDataReader readerd = CME. ExecuteReader ();
Readerd. Read ();
String Erchuan = (string) readerd[0]. ToString ();
Textbox5.text = Erchuan;
Readerd. Close ();
Con. Close ();
Con. Open ();
String sqf = "Select Qiuyuan from Allathlete ORDER by ziyouren Desc";
OleDbCommand CMF = new OleDbCommand (SQF, con);
OleDbDataReader readerf = CMF. ExecuteReader ();
Readerf. Read ();
String Ziyouren = (string) readerf[0]. ToString ();
TextBox1.Text = Faqiu;
TextBox2.Text = Kouqiu;
TextBox3.Text = Lanwang;
Textbox4.text = Yichuan;
Textbox5.text = Erchuan;
Textbox6.text = Ziyouren;
Reader. Close ();
}
Catch
{
MessageBox.Show ("No Game data! ");
}
Con. Close ();
}

private void Button1_Click (object sender, EventArgs e)
{
String conn = @ "Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\users\administrator\desktop\ statistics. mdb";
OleDbConnection con = new OleDbConnection (conn);
String sql = "Select Qiuyuan from Allathlete ORDER by score Desc";
Con. Open ();
OleDbCommand cmd = new OleDbCommand (Sql,con);
OleDbDataReader reader = cmd. ExecuteReader ();
Reader. Read ();
Try
{
String MVP = (string) reader[0]. ToString ();
Text. Text = MVP;
}
Catch
{
MessageBox.Show ("No Game data! ");
}
Reader. Close ();
Con. Close ();

}

private void Label4_click (object sender, EventArgs e)
{

}

private void Button2_Click (object sender, EventArgs e)
{
Text. Text = "";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
Textbox4.text = "";
Textbox5.text = "";
Textbox6.text= "";
}
}
}

7. Code Review

The basic realization of the desired function, no review.

8.

Use vs to test the code, refactor the code, and fix some of the problems.

Iii. Reporting

1. Test report

Test passed.

2. Computational effort

Time: One week

Code Cumulative Number: Indeterminate

Number of essays accumulated: not sure

3. Summary afterwards

Development of a software, there are many ways, you should find the simplest and practical, there are code implementation functions, some of the implementation of the existing code can not be implemented, need to continue to learn.

Last time PSP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.