Friday, 27 September 2013

Need to get one numeric result from Datagridview through textbox. Urgent help needed project due Monday

Need to get one numeric result from Datagridview through textbox. Urgent
help needed project due Monday

I managed to get all the filters in datagridview to work through textbox
except one filter and i really need help before monday its for my project.
For all the other filters i use " like " in my statement but there is a
field for a dispatch/complaint number and when i enter the number i want
just one filtered row and not all with wildcard in that column For
instance when i type " 1 " in my textbox i want result as just one row
with that dispatch number and not other rows containing numbers like " 10,
21 , 100," , just a single row with the dispatch number " 1 " here is the
code
//the actual filter
((DataTable)recordsdatagridview.DataSource).DefaultView.RowFilter = filter
+ " * '{0}'" + txtstatusvalue.Text.Trim().Replace("'", "''");
//to set the filter for the required column through dropdown combobox i-e:
dispno/compno
if (combosearchby.Text == "Complaint Number")
{
filter = "CONVERT(compno,'System.String')";
txtstatusvalue.Enabled = true;
}
i found the " * '{0}'" from here as well tweaked it a bit and got it to
work earlier but i have no idea what happened to the code and its not
working. sorry for a poorly typed post its my first time posting.. i need
help urgently and can provide any further details if necessary

No comments:

Post a Comment