Tag Archive: Debugging C Sharp


Non-invocable member System.Data.DataSet.Tables cannot be used like a method


After filling in your dataset with your data adapter, you probably want to transfer that information to a DataTable so that you can display it on a your page’s datagrid, use it in an export to .csv function or something to that nature. However during compile time you may receive the following error:

Non-invocable member ‘System.Data.DataSet.Tables’ cannot be used like a method

One of the reasons you may be receiving this error is due to the way you have the DataTable name enclosed.  It should be in brackets instead of parenthesis.

Code Example:

DataTable dtEmployeeList;
return dtEmployeeList = dsEmpTable.Table("Employees");

Instead change the parenthesis to brackets:

DataTable dtEmployeeList;
return dtEmployeeList = dsEmpTable.Table["Employees"];

Since methods headers consist of a method name followed by parenthesis, the compiler will read the first dsEmpTable.Tabe(. . . as an attempt to invoke a method.  Once you change it to brackets it should take care of the problem.


Everything in your code looks normal but for whatever reason your code will not work, you get the following error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement along with (") expected", "; expected", "Invalide expression term", etc…).

The problem may be as easy as adding a comma to your line of code.

For example if I have the following code:

<strong>int total = 10; int cnt = 2;  Console.WriteLine(&quot;The total is {0} and the count is {1}&quot;, total, cnt);</strong>

Omitting the comman between ‘{1}’ and ‘total’ would cause this error.  And although all the errors Visual Studio alerts you about other errors, adding that comma in this simple program would eliminate all those errors.