Solved

Need help in changing the underlying SQL for a DataGridView

Posted on 2006-06-16
3
176 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 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
EF5: Question about Metadata Artifact Processing 4 21
VB.NET 1 28
Obtain cell value using column ID in DataGrid using VB.NET 2 25
Visual Studios 1 76
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 …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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