Solved

Need help in changing the underlying SQL for a DataGridView

Posted on 2006-06-16
3
177 Views
Last Modified: 2010-04-23
Hello,

I need a way to change the SQL statement that is being applied to the DataGridView but I am not sure how to go about it. Do I need to apply it to the Table Adapter, the Binding Source or the Dataset?

What I want to do is have a combo box, text field and a button to apply filtering of the data on the fly. The operator will select from the combo box which field to search, then enter the search term and press the button to apply it.

Thanks
0
Comment
Question by:dijon316
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Sancler earned 250 total points
ID: 16926943
It sounds like you should use the .Filter property of the BindingSource.  It takes a String, which you could build "on the fly" on these lines

   Dim FilterString As String = <fieldnameselectedfromcombo> & " = '" & <textfromtextbox> & "'"
   MyBindingSource.Filter = FilterString

Roger
0
 

Author Comment

by:dijon316
ID: 16927987
It ssems when I apply the filter, nothing changes. Do I need to refresh something to cause the DataGridView to update?
0
 

Author Comment

by:dijon316
ID: 16928030
Nevermind, I was trying to asign the code to an unused button. It did work. Thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question