Can someone please help me with the followng problem. I currently have a sql express database which has records of movies (title, category etc). Users can retrieve the data through a datagrid on windows form. What I want is for a record to be retrieved through a matching string entered by the user. However, I am unsure of how to go about finding the string as the data is unpredetermined. Below is part of the code I am using for the search.
private void button3_Click_1(object sender, System.EventArgs e)
{
//Movset1 is dataset
Dv = new DataView(Movset1.Tables[0]);
dataGrid1.DataSource = Dv;
//Below code doesnt work
Dv.RowFilter = "Title = textBox1.Text";
}
Kirtan PatelPosted Oct 11, 2008, 11:22 AM
Thanks,
Happy Coding .. :-)
mark jonesPosted Oct 11, 2008, 11:18 AM
I tried your peice of code and it worked great I didnt even know about the Trim function, thank you very much for you help.
Kirtan PatelPosted Oct 10, 2008, 5:42 PM
Try Following Code
private void button3_Click_1(object sender, System.EventArgs e)
{
//Movset1 is dataset
Dv = new DataView(Movset1.Tables[0]);
dataGrid1.DataSource = Dv;
Dv.RowFilter = "Title ='"+textBox1.Text.Trim+"'";
}
Regards,
Kirtan