Click here to Skip to main content
15,892,005 members

Typed DataTable Return problem from WebService

H.Johnson asked:

Open original thread
Hi all,
I have a WinForm application and I also use a web service in this project. The problem is that;
There is 3 project in the solution. I>Data layer, II>Service Layer, III>Presentation Layer. There is some of typed DataSet in Data Layer and I can fill and return this dataset to the presentation layer without any problem. On the other hand, when I try to return a datatable in this dataset, the datatable returns empty. I checked and obtain that; the typed datatable is filled in Data Layer and returns to Service layer. The datatable is still fill on the service layer. But, when return it to the application layer, it is getting empty. Here is the sample code I used. I think DataTables can be returned on webservices as DataSets. I use Typed Datatable but it should be returned as well. Am I wrong?

On the Data Layer:
C#
public StudentDS.EXAMSDataTable ExamTable()
        {
            SelectAll(dataSet.EXAMS); //This method fills the EXAMS table in dataset.
            return dataSet.EXAMS;
        }



On the Service Layer:
[WebMethod(Description = "Returns EXAMS datatable")]
        public StudentDS.EXAMSDataTable WsExamTable()
        {
            StudentDS.EXAMSDataTable dt = myDataAccess.ExamTable(); //Returns filled Exam table from Data Access Layer
            return dt; //NOTE : The table is filled at this stage
        }


On the Presentation Layer:

private void btFill_Click(object sender, EventArgs e)
{
    dataGridView1.DataSource = myService.WsExamTable(); //NOTE : The table comes EMPTY from Service Layer at this stage
}



So, is there a mistake or how can I return filled datatable from a web service?
BR
Tags: DataTable, ClickOnce, Webservice

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900