Last post Mar 20, 2013 04:18 PM by hminnesota
Nov 19, 2007 11:42 AM|cmspinto|LINK
I have been reading in foruns but there is any problem when I try to put a row filter and I can not find it, the code is:
connPargroup = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
SqlCommand cmdPargroup = new SqlCommand("SELECT tblSpotID, Pargroup, Measurements FROM [DOME].[dbo].[vw_web_browse_summaryParamGroups]", connPargroup);
rdrParamGroup = cmdPargroup.ExecuteReader();
rdrParamGroup.GetSchemaTable().DefaultView.RowFilter = "tblSpotID=" + rdrSpots["tblSpotID"].ToString(); ///// In this line I receive the message:
Cannot find column [tblSpotID]. System.Data.EvaluateException: Cannot find column [tblSpotID]. at System.Data.NameNode.Bind(DataTable table, List`1 list) at System.Data.BinaryNode.Bind(DataTable
table, List`1 list) at System.Data.DataExpression.Bind(DataTable table) at System.Data.DataExpression..ctor(DataTable table, String expression, Type type) at System.Data.DataView.set_RowFilter(String value) at Browse_R91Map.Page_Load(Object sender, EventArgs
e) in c:\Inetpub\wwwroot\MyWeb\Browse\R91Map.aspx.cs:line 82
But it exists the column, does anybody know why I'm geting this error message?
ADO.NET data access
ADO.NET data access
Nov 19, 2007 01:20 PM|che3358|LINK
From you code, I assume your column tblSpotID is varchar. In this case, try putting singlw quote arond rdrSpots["tblSpotID"].ToString():
"tblSpotID='" + rdrSpots["tblSpotID"].ToString() + "'";
Nov 20, 2007 05:15 AM|cmspinto|LINK
I have try that and it give me the same message.
I think what the object cant find is the column and I don't know why.
Nov 21, 2007 02:03 AM|Bo Chen – MSFT|LINK
Based on my understanding, you are using dataview.rowfilter to filter which rows are to be viewed in dataview and you are experiencing a "cannot find data column" error message. If I've understood you wrong, please feel free to tell me, thanks.
I've made a test on my local machine and based on my knowledge and experience, I think the problem is that: there is no such column callled "tblSpotID" exsits in the schemal table. I would suggest you first binding the schemal talbe to a girdview and see
which column you can select from that table(likewise, what kind of rowfilter you can use in the defaultview of that table).
che3358 's suggestion is correct, if that specific column (tbSportID) does exist, that solution could solve the problem.
Hope my suggestion helps
Nov 25, 2007 10:20 AM|cmspinto|LINK
Hi, I have solved the problem by using a dataset insted of a datareader.
I think maybe the datareader doesn´t suport the filter because it is foward only.
But maybe Im wrong. So with the dataset it is slower but it suports the filter :)
Mar 20, 2013 04:18 PM|hminnesota|LINK
I have exact same issue but the problem is the issue occurs
1. only on server - I can't reproduce locally
2. happens very infrequently- the code at which it is throwing exception, gets accessed every time you change the index on selection. Based on selection, it will filter out the rows. If there was issue with column name, it should happen all the time.
Any other suggestions?
_docListTable.DefaultView.RowFilter = filter
at above line, it is failing.
System.Data.EvaluateException: Cannot find column [XXXXX]. at System.Data.NameNode.Bind(DataTable table, List`1 list) at System.Data.BinaryNode.Bind(DataTable table, List`1 list) at System.Data.DataExpression.Bind(DataTable table) at System.Data.DataView.set_RowFilter(String
value) at namespace1.DocumentList.FilterDocuments(DocumentStatus StatusCode) at namespace1.MainPage.ddStatus_SelectedIndexChanged(Object sender, EventArgs e)
Any suggestions would be helpful..It is db2 client.