[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help in changing the underlying SQL for a DataGridView

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

872 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