Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Looking at the code you have there for the row filter, it will translate to:</p> <pre><code>.RowFilter = "park_id = 100datum = something" </code></pre> <p>Notice the lack of space between the park_id and next field. You also need to add "and" (I think?)</p> <p>Try:</p> <pre><code>.RowFilter = String.Format("park_id = {0} and datum = {1}", i_index.Tostring, i_datum.ToString) </code></pre> <p>You may need to tinker this to include apostrophes depending on the types of your data (i.e. change to </p> <pre><code>... and datum = **'**{1}**'** </code></pre> <p>if it's a string)</p> <p>EDIT: In response to your comment.</p> <p>Have a look on <a href="http://www.csharp-examples.net/dataview-rowfilter/" rel="nofollow">this page</a> for some useful tips. For dates you use the # symbols.</p> <pre><code>.RowFilter = String.Format("park_id = {0} and datum = #{1}#", i_index.Tostring, i_datum.ToString) </code></pre> <p>EDIT: In response to your second comment ( formatException"String was not recognized as a valid DateTime." ):</p> <p>This is a little trickier. I'll list a possible quick solution, but by no means the <em>best</em> solution.</p> <pre><code>Dim customDateFormat As String = "MM/dd/yyyy hh:mm:ss" .RowFilter = String.Format("park_id = {0} and datum &gt;= #{1}# and datum &lt;= #{2}#", i_index.ToString, New DateTime(i_datum.Year, i_datum.Month, i_datum.Day, 0, 0, 0).ToString(customDateFormat), New DateTime(i_datum.Year, i_datum.Month, i_datum.Day, 23, 59, 59).ToString(customDateFormat)) </code></pre> <p>Basically, the chances are that when you compare your date's to the date times in the database, you want to ignore the time? (Making an assumption here). One way of doing this is to compare your database data with your date, ensuring it is between 00:00 AM and 23:59:59 PM.</p> <p>I've included a customDateFormat string which you can tamper if you need to, in order to reflect your locale. I know that date constants ignore locale, but I've no idea what it does inside the RowFilter as a string, and whether the database locale has any effect on it. If the above doesn't work, you can change the date format string to match your locale to see if that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload