Results 1 to 3 of 3

Thread: How to search or find the record & display it in the DataGrid?

  1. #1
    Join Date
    Aug 2008
    Posts
    40

    How to search or find the record & display it in the DataGrid?

    Hi,

    I am completing my project with SQL as back-end & VB.NET as front-end.
    Till now every thing i got OK!
    But now I don't understand how to find & sort a particular record in the field of my table from the database? Since i want to make a query to fetch the record & display in the same datagrid.

  2. #2
    Join Date
    Feb 2009
    Posts
    133

    Re: How to search or find the record & display it in the DataGrid?

    Well i don't think you need SQL query for find or search!
    If yes then

    Code:
    select * from tablename 
    
    ie. Dim cmd As SqlCommand = new SqlCommand("SELECT * FROM Tablename")
    I hope this is what you want!
    IF YOU CAN'T Convince THEM ...

    CONFUSE THEM ...

  3. #3
    Join Date
    May 2008
    Posts
    27

    Re: How to search or find the record & display it in the DataGrid?

    This is how I search a Dataset...

    Code:
    'Create a dataview
    dim dv as new dataview
    
    'Associate the dataview to _oDs (Dataset table)
    dv.Table = _oDs.Tables("tblCapitalCategory")
    
    Dim drv As DataRowView 'Data Row View object to query DataView object
    
    'Filter based on a combo box value selected
    dv.RowFilter = "[pkCapitalCategoryID] = " & CInt(cboComboBox.SelectedValue)
    
    'Retrieve my values returned in the result
    For Each drv In dv
         _dteDateModified = drv("dteDateModified")
    Next
    Hopefully you get some use of this. I use this method to search for any values in my datasets.

    Code:
    dv.RowFilter is the key to the search. It is kind of like a SQL where statement on the results of the dataset.
    The nice thing about this method is the original dataset is not manipulated in any way. You do everything based on a manipulated view of the datasets results.

Similar Threads

  1. How to clear the search record at the search bar in window 7
    By $OLIVER$ in forum Operating Systems
    Replies: 3
    Last Post: 21-01-2011, 01:07 PM
  2. file maker to display the contents of last record
    By Bigga Lexx in forum Windows Software
    Replies: 3
    Last Post: 09-09-2009, 03:26 PM
  3. ZeroTorrents: the search engine that will find nothing
    By Techguru01 in forum Technology & Internet
    Replies: 1
    Last Post: 13-01-2009, 05:10 PM
  4. Search Companion text search folder doesn't find all files
    By Hrishia in forum Windows XP Support
    Replies: 2
    Last Post: 27-11-2008, 10:16 PM
  5. I can't find my new record in MIPC
    By CLONEOPS in forum Hardware Peripherals
    Replies: 2
    Last Post: 18-08-2008, 07:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,875,593.88415 seconds with 16 queries