Hi all, I use the VB.Net 2012 and connected to an Access Database, that has only one Table (ex. Ges)the Table has 16 column (5 of them are String and the others are Integer data types). I have defined a DataView and want to Filter all the Data according to the Text that I type in the corresponding TextBoxes. So I have designed in the form, 16 TextBoxes and added a <btn Search> and a DataGrid. I want the following:
- When I clear the texts in the textBoxes and type any Text in the corresponding TextBox, and click the btnSearch, so the Filter must be done and I get the data in the GridView.
My Code:
Dim Name As String = txtName.Text
Dim SollStd As Integer = Val(txtSollStunden.Text).ToString()
.....etc
Dim tvw As New DataView(tbl)
tvw.RowFilter = String.Format("Name LIKE '{0}' AND SollStd LIKE '{1}' AND Column3 LIKE '{2}' AND Column4 LIKE '{3}' AND Column5 LIKE '{4}'" & "AND Column6 LIKE '{5}'", txtName.Text, txtSollSt.Text, txtColumn3.Text, txtColumn4.Text, txtColumn5.Text)
This code return an Error, "cannot perform 'like' operation on system.int32 and system.string". I have replaced the 'LIKE' with '='for the Number fileds, but the error still appears.
I want to ask, if it is possible to filter of all the fileds such as in Excel for example?
Can any one help me please.
- When I clear the texts in the textBoxes and type any Text in the corresponding TextBox, and click the btnSearch, so the Filter must be done and I get the data in the GridView.
My Code:
Dim Name As String = txtName.Text
Dim SollStd As Integer = Val(txtSollStunden.Text).ToString()
.....etc
Dim tvw As New DataView(tbl)
tvw.RowFilter = String.Format("Name LIKE '{0}' AND SollStd LIKE '{1}' AND Column3 LIKE '{2}' AND Column4 LIKE '{3}' AND Column5 LIKE '{4}'" & "AND Column6 LIKE '{5}'", txtName.Text, txtSollSt.Text, txtColumn3.Text, txtColumn4.Text, txtColumn5.Text)
This code return an Error, "cannot perform 'like' operation on system.int32 and system.string". I have replaced the 'LIKE' with '='for the Number fileds, but the error still appears.
I want to ask, if it is possible to filter of all the fileds such as in Excel for example?
Can any one help me please.