you could set the database as IEnumberable and use linq to check if the values exist. check out this link
LINQ Query on Datatable to check if record exists
the example given is
var dataRowQuery= myDataTable.AsEnumerable().Where(row => ...
you could supplement where with any
You can use Linq. Something like:
bool exists = dt.AsEnumerable().Where(c => c.Field<string>("Author").Equals("your lookup value")).Count() > 0;
DataRow rw = table.AsEnumerable().FirstOrDefault(tt => tt.Field<string>("Author") == "Name");
if (rw != null)
{
// row exists
}
add to your using clause :
using System.Linq;
and add :
System.Data.DataSetExtensions
to references.
You should be able to use the DataTable.Select() method. You can us it like this.
if(myDataTable.Select("Author = '" + AuthorName.Replace("'","''") + '").Length > 0)
...
The Select() funciton returns an array of DataRows for the results matching the where statement.
Source: Stackoverflow.com