Home > Net >  How RowFiletr screening of integer and string at the same time
How RowFiletr screening of integer and string at the same time

Time:09-25

Dv. RowFilter=(" system serial number='" + text + "' or product names like (' % % '" + text + ") ");
My the system serial number is Int32, the product name is a string type, execute this sentence will prompt (not in the system. Int32 and system. The string on=)
How can ask RowFilter do screening of different types of it at the same time, the great spirit to guide the bai, thank you

CodePudding user response:

Dv. RowFilter=(" system serial number='" + int. Parse (text) + "' or product names like (' % % '" + text + ") ");

CodePudding user response:

Whether the text can be converted to type Int, you enter a "toilet paper," with 1 # code will still be an error,

CodePudding user response:

Don't use RowFilter can use linq implementation?

Handwritten might be wrong. The overall mean that
 
Var query=dt. Asxxxx (). The where (d=& gt; D.f iles (" product name "). Contans (" ") | | d.f iles (" serial number ")==1)


Of course not rule out the problem of input you can judge whether the int... If it is not corresponding to the number 0

CodePudding user response:

To learn a little linq knowledge, need not splicing readable so bad statement, also error-prone,
http://www.tutorialsteacher.com/linq/linq-tutorials
  • Related