-1

I use adgv (advanced filter) to my dataGridView with DataBindingSource

computerDataSet is my Dataset

computerBindingSource is my BindingSourse

and computerTableAdapter is my TableAdapter

In my Load form it creats this one to load data from my table "Computer"

this.computerTableAdapter.Fill(this.computerDataSet.Computer);

But I have departmentId in my Computer table "deptId" and I want to use "Where Clause..." I want to put condition but I don't know how to do it. In linq I would do like this

var computers = db.Computer.Where(x =>x.deptId == departmentId).Tolist(); // I have value of departmentId

But How can I put like Where condition in this code

this.computerTableAdapter.Fill(this.computerDataSet.Computer);

Thank you guys in advance!

Anna
  • 69
  • 1
  • 10
  • You need to change the adapter `SelectCommand` – Charlieface Feb 22 '21 at 20:36
  • @Charlieface , thank you for your response. Please I am new for this kind of staff and I dont know what you mean to change SelectCommand. Cna you please write me some code what and how do you mean? – Anna Feb 22 '21 at 20:52
  • No I can't because I have no idea where that adapter comes from, you have provided no code for it – Charlieface Feb 22 '21 at 20:57
  • @Charlieface . it creats it' self when I create connection with BindingSourse – Anna Feb 22 '21 at 21:08

2 Answers2

0

Advanced DatagridView Tasks I clicked "Add Query" and Created a new query enter image description here

Anna
  • 69
  • 1
  • 10
0

You open the DataSet file where the tableadapter lives, right click on it and choose Add Query. You can add any number of queries to a tableadapter

Caius Jard
  • 72,509
  • 5
  • 49
  • 80