The main problem is that you want to return two dissimilar types, which would mean that your function would have to return an
object
- the highest common class between the two.
And that makes your function very difficult to use, because each time you call it, you have to check what type it returned, and cast it to the appropriate type before you can report an error or use it. That's bad design.
Instead, give the method
out
parameters:
public bool PostUserLogin(string UserId, string Password, out DataTable results, out string errorMessage)
Then return a bool which is true if it worked, and false if it failed.
The "outside world" can then use the appropriate parameter and continue without problems.