private void readButton_Click(object sender, System.EventArgs e) { int i = 0; this.timer.Stop(); rd.rolls.Clear(); nPoints = 0; string strSQL = "SELECT nRolls,Victim,X,Y,oldX,OldY,Alpha,Red,Green,Blue From RollsTable"; oleDbConnection.Open(); OleDbCommand cmd = new OleDbCommand(strSQL,oleDbConnection); OleDbDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { rd.AddRow( int.Parse((rdr["nRolls"]).ToString()), int.Parse((rdr["Victim"]).ToString()), float.Parse((rdr["X"]).ToString()), float.Parse((rdr["Y"]).ToString()), float.Parse((rdr["oldX"]).ToString()), float.Parse((rdr["oldY"]).ToString()), int.Parse((rdr["Alpha"]).ToString()), int.Parse((rdr["Red"]).ToString()), int.Parse((rdr["Green"]).ToString()), int.Parse((rdr["Blue"]).ToString()) ); i++; } rdr.Close(); oleDbConnection.Close(); rpDataGrid.DataSource = rd.rolls; nPoints = i; this.timer.Start(); } |
Листинг 18.10. |
Закрыть окно |