public void GetSearchResult(string searchText) { string GetSearchResult = "Select * FROM [User] where Name like '" + searchText + "%'"; dt = dbClass.ConnectDataBaseReturnDT(GetSearchResult); if (dt.Rows.Count > 0) { SearchResultList.DataSource = dt; SearchResultList.DataBind(); } }
public void LoadData() { if (RadTextBox1.Text != "") { string name = RadTextBox1.Text; string GetSearchResult = @"SELECT [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image FROM [User] INNER JOIN Propic ON [User].ID = Propic.UID WHERE ([User].Name LIKE '" + name + "%') AND (Propic.[Current] = 1)"; dt = dbClass.ReturnDT(GetSearchResult); if (dt.Rows.Count > 0) { SearchResultList.DataSource = dt; SearchResultList.DataBind(); SearchResultList.Visible = true; error0.Visible = false; } else if (dt.Rows.Count == 0) { SearchResultList.Visible = false; error0.Visible = true; } } if (RadTextBox2.Text != "") { string name = RadTextBox1.Text; string GetSearchResult = @"SELECT [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image FROM [User] INNER JOIN Propic ON [User].ID = Propic.UID WHERE ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "'"; dt = dbClass.ReturnDT(GetSearchResult); if (dt.Rows.Count > 0) { SearchResultList.DataSource = dt; SearchResultList.DataBind(); SearchResultList.Visible = true; error0.Visible = false; } else if (dt.Rows.Count == 0) { error0.Visible = true; } } if (RadTextBox3.Text != "") { string name = RadTextBox1.Text; string GetSearchResult = @"SELECT [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image FROM [User] INNER JOIN Propic ON [User].ID = Propic.UID WHERE ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "%' AND Company like'" + RadTextBox3.Text + "%'"; dt = dbClass.ReturnDT(GetSearchResult); if (dt.Rows.Count > 0) { SearchResultList.DataSource = dt; SearchResultList.DataBind(); SearchResultList.Visible = true; } else if (dt.Rows.Count == 0) { error0.Visible = true; } } if (RadTextBox4.Text != "") { string name = RadTextBox1.Text; string GetSearchResult = @"SELECT [User].Name, [User].Country, [User].RegisterDate, [User].College, [User].Relationship, [User].BirthDate, [User].School, [User].Company, [User].Gender, [User].City, [User].ID, [User].uname, [User].Phone, [User].Degree, [User].Designation, Propic.Image FROM [User] INNER JOIN Propic ON [User].ID = Propic.UID WHERE ([User].Name LIKE '" + name + "') AND (Propic.[Current] = 1) AND Country like '" + RadTextBox2.Text + "%' AND Company like '" + RadTextBox3.Text + "%' AND School like '" + RadTextBox4.Text + "%'"; dt = dbClass.ReturnDT(GetSearchResult); if (dt.Rows.Count > 0) { SearchResultList.DataSource = dt; SearchResultList.DataBind(); SearchResultList.Visible = true; error0.Visible = false; } else if (dt.Rows.Count == 0) { error0.Visible = true; } } if (SearchResultList.Visible == true) { error0.Visible = false; error.Visible = false; } }