0

how to rowfilter a row using textbox for date and time or only date ?
plsss help

i am getting error with this code
dv.RowFilter = "Date = '" +textBox1.Text.ToString()+"'";

thanks :)

5
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Randlathor05
0

knowing the error you're getting would help a lot. As a side note, you don't need to use .ToString() on the Text property of a textbox control, it's already a string.

0

Is it date formatting error? try to use date formats.

Edited by osama717

0

Ill try posting again as the last one is nt showing?

you could try formatting times and dates like so...

DateTime thisDate1 = new DateTime(2011, 6, 10);
Console.WriteLine("Today is " + thisDate1.ToString("MMMM dd, yyyy") + ".");

notice the single quotes in the example below...

private void MakeDataView() 
{
    DataView view = new DataView();

    view.Table = DataSet1.Tables["Suppliers"];
    view.AllowDelete = true;
    view.AllowEdit = true;
    view.AllowNew = true;
    view.RowFilter = "City = 'Berlin'";
    view.RowStateFilter = DataViewRowState.ModifiedCurrent;
    view.Sort = "CompanyName DESC";

    // Simple-bind to a TextBox control
    Text1.DataBindings.Add("Text", view, "CompanyName");
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.