Filter expression '1' does not evaluate to a Boolean term

When does this error happen? At which line? What are you trying to do in order to cause this error? Dumping a series of methods on here and telling us that it's generating an error does not help us solve your problem. Be more specific.

Commented Feb 19, 2015 at 5:18 I guess your Dataview filter is wrong. Check with dv.RowFilter="country_id >0"; Commented Feb 19, 2015 at 5:31 here i used two table table 1 and table 2 .one stored in data row Commented Feb 19, 2015 at 5:35 this dr only i mapped row filter Commented Feb 19, 2015 at 5:35

i used to two table table. my stored procedure ALTER PROCEDURE [dbo].[sp_new] AS BEGIN declare @sql varchar(max) SET NOCOUNT ON; select @sql='select * from country;select * from state' exec(@sql) print(@sql) END

Commented Feb 19, 2015 at 5:40

1 Answer 1

DataSet ds = new DataSet(); DataSet dstemp = new DataSet();

 con = new SqlConnection(str); con.Open(); cmd = new SqlCommand("sp_new", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); DataView dv = ds.Tables[1].DefaultView; if(ds.Tables[0].Rows.Count>1) < for (int i = 0; i < ds.Tables[0].Rows.Count; i++) < DataRow dr = ds.Tables[0].Rows[i]; dv.RowFilter = "country_id = " + dr["country_id"]; dstemp.Tables.Add(dv.ToTable(dr["country_name"].ToString())); >> return dstemp;