/// <summary> /// ini fitur untuk mencari data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbSearch_TextChanged(object sender, EventArgs e) { AksesDB data = new AksesDB(); String datacari = tbSearch.Text; dt = data.caridata(datacari); if (tbSearch.Text != "") { // koneksi.Open(); // string query = "select * from penghunikoskosan where Nama like '%" + datacari + "%' or NoKamar like'%"+datacari+"%'"; // da = new SqlDataAdapter(query, koneksi); // dt = new DataTable(); // da.Fill(dt); // koneksi.Close(); dView.DataSource = dt; } else if (tbSearch.Text == "") { dView.DataSource = data.datadb(); dView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } }
public void search1() { AksesDB adb = new AksesDB(); Assert.AreEqual(null, adb.caridata("")); }