void Button6Click(object sender, EventArgs e) { // Search based on last name , race and bib number if (textBoxBib2.Text != "") { sqlsearchrunner = string.Format("Select * from Athletes WHERE BibNumber = '{0}' AND Race = '{1}'", textBoxBib2.Text, comboBoxRace2.Text); try { runner = DbSqlite.GetDataSetSqlite(sqlsearchrunner); if (runner.Tables[0].Rows.Count != 0) { comboBoxRace2.Text = runner.Tables[0].Rows[0]["Race"].ToString(); textBoxFname.Text = runner.Tables[0].Rows[0]["Fname"].ToString(); textBoxLname2.Text = runner.Tables[0].Rows[0]["Lname"].ToString(); comboBoxSex.Text = runner.Tables[0].Rows[0]["Sex"].ToString(); comboBoxStatus2.Text = runner.Tables[0].Rows[0]["Status"].ToString(); dateTimePicker1.Text = runner.Tables[0].Rows[0]["DOB"].ToString(); textBoxBib2.Text = runner.Tables[0].Rows[0]["BibNumber"].ToString(); textBoxGunStart.Text = runner.Tables[0].Rows[0]["GunStart"].ToString(); textBoxManualEnd.Text = runner.Tables[0].Rows[0]["ManualEnd"].ToString(); runneruniquekey = runner.Tables[0].Rows[0]["unique_key"].ToString(); } } catch { MessageBox.Show("No result for that search"); } } }
private void PopulateMenu() { string NewQuery = "Select * from Races"; //+ "\'%"+ SelectRace.Text+"\'"; //Console.WriteLine(NewQuery); //Pass string to function here.... /// <remarks> /// Creating a DataSet to feed the DataGridView /// </remarks> // DataSet results = new DataSet(); try { results = DbSqlite.GetDataSetSqlite(NewQuery); ChooseRace.DataSource = results.Tables[0]; ChooseRace.DisplayMember = "RaceName"; ChooseRace.BindingContext = BindingContext; //dataGridView1.DataSource = results.Tables[0].DefaultView; } catch (Exception error) { MessageBox.Show("Exception caught: " + error.Message); } }
public Races() { // // The InitializeComponent() call is required for Windows Forms designer support. // try { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); DataSet menu = DbSqlite.GetDataSetSqlite("SELECT * FROM races"); ChooseRace.DataSource = menu.Tables[0]; ChooseRace.DisplayMember = "RaceName"; ChooseRace.BindingContext = BindingContext; dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = menu.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Button7Click(object sender, EventArgs e) { // Save changes back to DB string updatesqlrunner = string.Format("UPDATE Athletes SET Fname = '{0}', Lname = '{1}', Sex= '{2}', DOB= '{3}', Race= '{4}', Status= '{5}', BibNumber= '{6}', GunStart= '{7}', ManualEnd= '{8}' WHERE unique_key='{9}'", textBoxFname.Text, textBoxLname2.Text, comboBoxSex.Text, dateTimePicker1.Text, comboBoxRace2.Text, comboBoxStatus2.Text, textBoxBib2.Text, textBoxGunStart.Text, textBoxManualEnd.Text, runneruniquekey); DbSqlite.SimpleSQliteAction(updatesqlrunner); //update the view runner = DbSqlite.GetDataSetSqlite(sqlsearchrunner); }
void Button3Click(object sender, System.EventArgs e) { //save changes to db string updateracesql = string.Format("UPDATE Races SET RaceOver = '{0}', RaceLaps = '{1}', RaceHours = '{2}', RaceType = '{3}' WHERE RaceName = '{4}'", comboBoxStatus.Text, textBoxRaceLaps.Text, textBoxRaceLength.Text, comboBoxType.Text, textBoxRaceName.Text); Console.WriteLine(updateracesql); DbSqlite.SimpleSQliteAction(updateracesql); //refresh data in view ds2 = DbSqlite.GetDataSetSqlite(thissearchstring); }
void Button1Click(object sender, EventArgs e) { thissearchstring = string.Format("Select * from Races where RaceName = '{0}'", ChooseRace.Text); // where RaceName ="+ChooseRace.Text; ds2 = DbSqlite.GetDataSetSqlite(thissearchstring); textBoxRaceName.Text = ds2.Tables[0].Rows[0]["RaceName"].ToString(); textBoxRaceLength.Text = ds2.Tables[0].Rows[0]["RaceHours"].ToString(); textBoxRaceLaps.Text = ds2.Tables[0].Rows[0]["RaceLaps"].ToString(); comboBoxStatus.Text = ds2.Tables[0].Rows[0]["RaceOver"].ToString(); comboBoxType.Text = ds2.Tables[0].Rows[0]["RaceType"].ToString(); //dataGridView2.DataSource = ds2.Tables[0]; }
void Button2Click(object sender, EventArgs e) { thissearchstring = string.Format("Select * from Races"); //where RaceName = '{0}'",ChooseRace.Text); Console.WriteLine(thissearchstring); DbSqlite.SaveDataTable(dataGridView1, thissearchstring); DataSet menu = DbSqlite.GetDataSetSqlite("SELECT * FROM races"); ChooseRace.DataSource = menu.Tables[0]; ChooseRace.DisplayMember = "RaceName"; ChooseRace.BindingContext = BindingContext; dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = menu.Tables[0]; }
private void FillData(string selectCommand) { DataSet ds = new DataSet(); ds = DbSqlite.GetDataSetSqlite(selectCommand); dataGridView2.DataSource = ds.Tables[0]; DataView overall = ds.Tables[0].DefaultView; overall.Sort = "OverallPos ASC"; dataGridView2.DataSource = overall; if (checkBox4.Checked == true) { DataView agecat = ds.Tables[0].DefaultView; agecat.Sort = "AgeCat ASC, CatPos ASC"; dataGridView2.DataSource = agecat; } }
void Button1Click(object sender, EventArgs e) { TimersWindow tww = new TimersWindow(); tww.TimerRaceName = SelectRace2.Text; //check the db to see if this race is already started //if it is we use the existing start time //if not we write the starttime to the db //selectquery = "Select * from Races where " //ExecuteSQLQuery("Select * from Races where RaceName ="); //fill the datatable string racestartquery = string.Format("Select * from Races WHERE RaceName = '{0}'", SelectRace2.Text); Console.WriteLine(racestartquery); //FillData(racestartquery); //search the datatable for the value //string connstring = "Data Source=RFIDTAGSTORE.s3db"; CreateSQLiteDataReader(racestartquery); tww.RaceTimeStartTime = DateTime.Now.ToLocalTime(); try { tww.RaceTimeStartTime = Convert.ToDateTime(RaceStartValue); } catch { string sqlinsert = string.Format("UPDATE Races SET RaceStart='{0}', RaceOver = '{1}' WHERE RaceName ='{2}'", tww.RaceTimeStartTime, "Running", SelectRace2.Text); Console.WriteLine(sqlinsert); DbSqlite r = new DbSqlite(); // DbSqlite.RFIDTAGSTORE.Open(); r.SimpleSQliteInsert(sqlinsert); //Lets also set the GunTime for all the athletes in the race. string setstartsql = string.Format("UPDATE Athletes SET GunStart='{0}', NettTotal = null, GunTotal = null, OverallPos = null, GenderPos = null, CatPos = null WHERE Race='{1}'", tww.RaceTimeStartTime.ToString(), SelectRace2.Text); r.SimpleSQliteInsert(setstartsql); Console.WriteLine(setstartsql); // DbSqlite.RFIDTAGSTORE.Close(); } //tww.RaceTimeStartTime = SQLRaceStartTime; tww.RaceLaps = RaceLaps; tww.RaceHours = RaceHours; tww.RaceType = RaceType; tww.Text = SelectRace2.Text + " Timer"; tww.Show(); // var race = new formstest.MainClass.Races(); // race.RaceName = SelectRace2.Text; }