private void searchButton_Click(object sender, EventArgs e) { oleDbDataAdapter1.SelectCommand.CommandText = "select * from employee"; dataSet1.Clear(); oleDbDataAdapter1.Fill(dataSet1, "employee"); SearchDataGrid.SetDataBinding(dataSet1, "employee"); }
/// Creature search void SearchButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(SearchEntry.Text) && string.IsNullOrWhiteSpace(SearchName.Text) && string.IsNullOrWhiteSpace(SearchSubName.Text)) { MessageBox.Show("Need to add value to one of column!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IQueryable <creature_template> query = world.creature_template; if (!string.IsNullOrWhiteSpace(SearchEntry.Text)) { query = query.Where(x => x.entry.ToString() == SearchEntry.Text); } if (!string.IsNullOrWhiteSpace(SearchName.Text)) { query = query.Where(x => x.name.Contains(SearchName.Text.Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(SearchSubName.Text)) { query = query.Where(x => x.subname.Contains(SearchSubName.Text.Replace("'", "''"))); } var result = query.Select(x => new { x.entry, x.name, x.subname, x.minlevel, x.maxlevel, x.npcflag }).ToList(); SearchDataGrid.Load(result); }
void SearchButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(SearchEntry.Text) && string.IsNullOrWhiteSpace(SearchName.Text) && string.IsNullOrWhiteSpace(SearchType.Text) && string.IsNullOrWhiteSpace(SearchDisplayID.Text)) { MessageBox.Show("Need to add value to one of column!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IQueryable <gameobject_template> query = world.gameobject_template; if (!string.IsNullOrWhiteSpace(SearchEntry.Text)) { query = query.Where(x => x.entry.ToString() == SearchEntry.Text); } if (!string.IsNullOrWhiteSpace(SearchName.Text)) { query = query.Where(x => x.name.Contains(SearchName.Text.Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(SearchType.Text)) { query = query.Where(x => x.type == Convert.ToInt32(SearchType.Text)); } if (!string.IsNullOrWhiteSpace(SearchDisplayID.Text)) { query = query.Where(x => x.displayId == Convert.ToInt32(SearchDisplayID.Text)); } var result = query.Select(x => new { x.entry, x.name, x.displayId, x.type, x.flags, x.size }).ToList(); SearchDataGrid.Load(result); }
private void bunifuImageButton1_Click(object sender, EventArgs e) //Добавить магазин { successLabel.Visible = false; SearchDataGrid.Rows.Add("Семья"); for (int i = 0; i < SearchDataGrid.Rows.Count; i++) { for (int j = 0; j < SearchDataGrid.Columns.Count; j++) { SearchDataGrid.Rows[i].Cells[j].ReadOnly = true; } } SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[1].ReadOnly = false; SearchDataGrid.CurrentCell = SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[1]; SearchDataGrid.BeginEdit(true); }
private void bunifuImageButton1_Click(object sender, EventArgs e) { errorLabel.Visible = false; SearchDataGrid.Rows.Add(); for (int i = 0; i < SearchDataGrid.Rows.Count; i++) { for (int j = 0; j < SearchDataGrid.Columns.Count; j++) { SearchDataGrid.Rows[i].Cells[j].ReadOnly = true; } } //SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[0].ReadOnly = false; //SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[1].ReadOnly = false; //SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[2].ReadOnly = false; //SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[3].ReadOnly = false; //SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[4].ReadOnly = false; SearchDataGrid.CurrentCell = SearchDataGrid.Rows[SearchDataGrid.Rows.Count - 1].Cells[0]; SearchDataGrid.CurrentRow.ReadOnly = false; SearchDataGrid.BeginEdit(true); }