C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Filter record and fill like a auto fill combobox


Posted Date: 07 May 2008    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Debasmit Samal       Member Level: Gold
Rating:     Points: 5



using System.Data.OleDb;

public class FilterData
{

private void btnFilter_Click(object sender, System.EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\\TestDB.mdb");
OleDbCommand Testcmd = new OleDbCommand("SELECT * FROM Filtertable", con);
con.Open();
OleDbDataAdapter myTestDA = new OleDbDataAdapter(Testcmd);
DataSet ds = new DataSet();
myTestDA.Fill(ds, "TestFiltertable"); //Fill DataSet object with data

con.Close();

// Binding the datatable to DataGridView
DataGridView1.DataSource = ds.Tables("TestFiltertable").DefaultView;

//Filter datatable view
ds.Tables("TestFiltertable").DefaultView.RowFilter = "Name=" + TextBox1.Text;
//Or you can do like below search Criteria for dyanamic search
// or = "Username Like '%" & TextBox1.Text & "%' "
}

}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: VB.NET Class for Database manipulation
Previous Resource: Build up a DataSet
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

audio conferencing services

Contact Us    Privacy Policy    Terms Of Use