Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

System.Data.EvaluateException: 'Cannot find column [NameID].'

$
0
0

I am using a search textbox (TxtNameSearch) to filter data in a datagridview in a C# Winforms application in Visual Studio, where an user will enter a certain primary key (i.e. NameID) in the search box to filter the results in the datagridview. It throws the error which is noted in the title.

 private void TxtNamecSearch_TextChanged(object sender, EventArgs e)
    {
        DataView dtvNames = new DataView(dtNames);
        dtvNames.RowFilter = string.Format("Convert    
    (NameID,'System.String') Like '%{0}%'", TxtNameSearch.Text);     //   
    Errror occurs on this line
        NameDataGridView.DataSource = dtvNames;
    }

I expect to type in the textbox, the primary key [NameID] which is a numeric number and the results in the datagridview will automatically filter by the column "NameID"




Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>