The problem was caused by his carelessness, when it was fixed to the code, but there was no clue at all, knowing that I had found a problem in the realization.
Here's the code for the error:
datarow[] Tmpdrlist = TMPDT. Select (String. Format ("UserGroup = {0}", dr["UserGroup"]. ToString ()));
The above code does not have any grammatical problems, only when the problem occurs at the time of operation, then the best solution, and finally from the business implementation found that the database field UserGroup is a string, this is the reason, the code after the change is as follows:
datarow[] Tmpdrlist = TMPDT. Select (String. Format ("usergroup = ' {0} '", dr["UserGroup"]. ToString ()));
This is the single quotation mark question, this kind of question is really very silent.
Summarize:
1. If compile without error, but run the times wrong, then generally is the business implementation is incorrect or other features, so this time you need to check the business and logical implementation, not grammatical errors.
2. How to improve this detail is a more important issue, which is a bit of a waste of time.
This article from the "more efforts, the more fortunate" blog, declined reprint!
C # Query Database issues: Min (1) must is less than or equal to Max ( -1) in Range object