private void orderInsert_Load(object sender, EventArgs e) { //Lord data dgv DataTable dt = c.Select(); orderView.DataSource = dt; }
private void txtSearch_TextChanged_1(object sender, EventArgs e) { //search the data string keyword = txtSearch.Text; if (keyword == "ID OR Supplier Name") { DataTable dt = c.Select(); orderView.DataSource = dt; } else { SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM orderDetails WHERE orderID LIKE '%" + keyword + "%' OR supplierName LIKE '%" + keyword + "%' OR orderDate LIKE '%" + keyword + "%' OR inventoryType LIKE '%" + keyword + "%' OR amount LIKE '%" + keyword + "%'", conn); DataTable dt = new DataTable(); sda.Fill(dt); orderView.DataSource = dt; } }