Databases Reference
In-Depth Information
Else
length = kwc(orderPosition).Index - startPos
End If
sbFilterText.Append(cmdText.Substring(startPos, length))
Me.dataView.RowFilter = sbFilterText.ToString
End If
End Sub
After you parse the text, you will use the DataView.RowFilter property to filter out results. Simply
apply the string that you have extracted to the RowFilter , and the DataView class takes care of the rest.
The same technique is applied to get ordering.
C#
public void ValidateSorting(string cmdText)
{
if(sorting)
{
StringBuilder sbFilterText = new StringBuilder();
int startPos =0;
int length =0;
//start from end of 'Order by' clause
startPos = (kwc[orderPosition].Index +
kwc[orderPosition].Length+1);
length = cmdText.Length - startPos;
sbFilterText.Append(cmdText.Substring(startPos,length));
this.dataView.Sort = sbFilterText.ToString();
}
}
VB.NET
Private Sub ValidateSorting(ByVal cmdText As String)
If sorting Then
Dim sbFilterText As StringBuilder = New StringBuilder
Dim startPos As Integer = 0
Dim length As Integer = 0
startPos = (kwc(orderPosition).Index + kwc(orderPosition).Length + 1)
length = cmdText.Length - startPos
sbFilterText.Append(cmdText.Substring(startPos, length))
Me.dataView.Sort = sbFilterText.ToString
End If
End Sub
CommandTimeout Property
The CommandTimeout property is used to specify how long the command object should wait for the
results of an executed command before throwing an exception. You are not actually using this value, but
it must be implemented due to interface requirements. Just return a zero value to indicate timeouts are
not supported.
Search WWH ::




Custom Search