Just be a little more thoughtful about it:
StringBuilder sb = new StringBuilder();
bool join = false;
join = AddFilterData(sb, "cosname", combo_cosname.SelectedItem, join);
...
dv.RowFilter = sb.ToString();
...
private bool AddFilterData(StringBuilder sb, string field, object value, bool join)
{
if (value != null)
{
string s = value.ToString();
if (!string.IsNullOrEmpty(s))
{
if (join)
{
sb.Append(" AND ");
}
sb.AppendFormat("{0}='{1}' ", field, s);
join = true;
}
}
return join;
}