c# - Like methods for integer field in LINQ query -
the following code statement throws error can help?
var results = c in dt.asenumerable() sqlmethods.like(c.field<int>("design_no").tostring(), "%" + auto_txt_desi.text.tostring() + "%,") select c; dataview view = results.asdataview(); dt = view.totable();
sqlmethods.like
method linq-to-sql
query database not linq-to-dataset
subset of linq-to-objects
. can use pure .net methods instead:
var rows = row in dt.asenumerable() let design_no = row.field<int>("design_no").tostring() design_no.contains(auto_txt_desi.text) select row;
msdn:
the sql server
like
functionality cannot exposed through translation of existing common language runtime (clr) , .net framework constructs, , unsupported outside of linq sql context. use of method outside of linq sql will throw exception of typenotsupportedexception
.
Comments
Post a Comment