public Location() { InitializeComponent(); //set variable then call the method for dataset to datagridview1 //var test = DatabaseProcess.DataSetUsers(); //var test = DatabaseProcess.DataSetHumanServices(); //var test = DatabaseProcess.DataSetEmergencyServices(); //var test = DatabaseProcess.DataSetServicesOffered(); //join table datasets //var test = DatabaseProcess.TwoTableDataSetHumanOffered(); //var test = DatabaseProcess.TwoTableDataSetEmergencyOffered(); var test = DatabaseProcess.AllUserDataSet(); dataGridView1.DataSource = test; dataGridView1.DataMember = test.Tables[0].ToString(); //calling methods with return string value to a label named lblLocations //lblLocations.Text = DatabaseProcess.ReadDataBase(); //lblLocations.Text = DatabaseProcess.ReadHumanServices(); //lblLocations.Text = DatabaseProcess.ReadEmergencyServices(); //lblLocations.Text = DatabaseProcess.ReadServicesOffered(); }
public List <string> SearchDataset(string wordSearched) { List <string> rowList = new List <string>(); if (wordSearched != null) { //connection.ConnectionString = "Server=cis1.actx.edu;Database=project2;User Id=db2;Password=db20;"; //connection.Open(); //using (SqlCommand search = connection.CreateCommand()) //{ // System.Diagnostics.Debug.WriteLine(connection.ServerVersion); // search.CommandText = "select ..."; // haven't figure the SQL code out. // connection.Close(); //} var testForEmergencyServices = DatabaseProcess.DataSetEmergencyServices(); var subset1 = testForEmergencyServices.Tables[0].Select("Company >= '" + wordSearched + "' or Email >= '" + wordSearched + "' or Phone >= '" + wordSearched + "' or City >= '" + wordSearched + "' or State >= '" + wordSearched + "' or Address >= '" + wordSearched + "'"); // Print column 0 of each returned row. for (int i = 0; i < subset1.Length; i++) { rowList.Add(subset1[i].ToString()); } var testForHumanServices = DatabaseProcess.DataSetHumanServices(); var subset2 = testForHumanServices.Tables[0].Select("Company >= '" + wordSearched + "' or Email >= '" + wordSearched + "' or Phone >= '" + wordSearched + "' or City >= '" + wordSearched + "' or State >= '" + wordSearched + "' or Address >= '" + wordSearched + "'"); // Print column 0 of each returned row. for (int i = 0; i < subset2.Length; i++) { rowList.Add(subset2[i].ToString()); } } return(rowList); }