[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Need help in changing the underlying SQL for a DataGridView

Posted on 2006-06-16
3
Medium Priority
?
180 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

650 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