473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Web Service Method Can't return a DataTable?

I don't get it. A DataTable can't be returned, but a DataSet can. Yet a
DataSet contains one or more DataTables. So obviously a DataTable must be
serializable. So why not just let me return a DataTable?

Thanks for your advice,

- Joe Geretz -
Feb 21 '07 #1
4 10196
Hi,
In .NET 2.0 even DataTable is serializable.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Joseph Geretz" wrote:
I don't get it. A DataTable can't be returned, but a DataSet can. Yet a
DataSet contains one or more DataTables. So obviously a DataTable must be
serializable. So why not just let me return a DataTable?

Thanks for your advice,

- Joe Geretz -
Feb 21 '07 #2
Hi Manish,

I am trying to do as you suggest, however for some reason, the proxy doesn't
seem to generate the proper return type.

Here's the Web Service Method:

[WebMethod]
[SoapHeader("m_Token", Direction = SoapHeaderDirection.InOut)]
public DataTable GetUserProfile()

Here's the line of code I use to call this method:

DataTable DT = (DataTable) m_ServerApp.GetUserProfile();

Here's the error which the compiler throws:

Cannot convert type
'WSAClient.ServerApp.GetUserProfileResponseGetUser ProfileResult' to
'System.Data.DataTable'

I don't get it. What sort of return type is
GetUserProfileResponseGetUserProfileResult? (BTW, the cast is irrelevant to
this question, without the cast I get 'cannot implicitly convert yada, yada,
yada'.)

BTW, the fellow here is experiencing the same issue, but I didn't see that
he got an answer.

http://www.thescripts.com/forum/thread430347.html

Anyone have the answer to this problem?

Thanks!

- Joseph Geretz -
"Manish Bafna" <Ma*********@discussions.microsoft.comwrote in message
news:D0**********************************@microsof t.com...
Hi,
In .NET 2.0 even DataTable is serializable.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Joseph Geretz" wrote:
>I don't get it. A DataTable can't be returned, but a DataSet can. Yet a
DataSet contains one or more DataTables. So obviously a DataTable must be
serializable. So why not just let me return a DataTable?

Thanks for your advice,

- Joe Geretz -

Feb 22 '07 #3
More info:

I went into the proxy and hand coded it to:

public System.Data.DataTable GetUserProfile()
{
object[] results = this.Invoke("GetUserProfile", new object[0]);
return ((System.Data.DataTable)(results[0]));
}

But the next time I refresh the web service, it reverts back to:

public GetUserProfileResponseGetUserProfileResult GetUserProfile()
{
object[] results = this.Invoke("GetUserProfile", new object[0]);
return ((GetUserProfileResponseGetUserProfileResult)(resu lts[0]));
}

If I have to keep handcoding this every time I need to refresh the proxy
with the latest Web Service definitions, then this is a non-starter; I'll
have to go back to using a DataSet, rather than a DataTable.

Any idea what's going wrong here?

Thanks!

- Joseph Geretz -

"Joseph Geretz" <jg*****@nospam.comwrote in message
news:OP**************@TK2MSFTNGP04.phx.gbl...
Hi Manish,

I am trying to do as you suggest, however for some reason, the proxy
doesn't seem to generate the proper return type.

Here's the Web Service Method:

[WebMethod]
[SoapHeader("m_Token", Direction = SoapHeaderDirection.InOut)]
public DataTable GetUserProfile()

Here's the line of code I use to call this method:

DataTable DT = (DataTable) m_ServerApp.GetUserProfile();

Here's the error which the compiler throws:

Cannot convert type
'WSAClient.ServerApp.GetUserProfileResponseGetUser ProfileResult' to
'System.Data.DataTable'

I don't get it. What sort of return type is
GetUserProfileResponseGetUserProfileResult? (BTW, the cast is irrelevant
to this question, without the cast I get 'cannot implicitly convert yada,
yada, yada'.)

BTW, the fellow here is experiencing the same issue, but I didn't see that
he got an answer.

http://www.thescripts.com/forum/thread430347.html

Anyone have the answer to this problem?

Thanks!

- Joseph Geretz -
"Manish Bafna" <Ma*********@discussions.microsoft.comwrote in message
news:D0**********************************@microsof t.com...
>Hi,
In .NET 2.0 even DataTable is serializable.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Joseph Geretz" wrote:
>>I don't get it. A DataTable can't be returned, but a DataSet can. Yet a
DataSet contains one or more DataTables. So obviously a DataTable must
be
serializable. So why not just let me return a DataTable?

Thanks for your advice,

- Joe Geretz -


Feb 22 '07 #4
On 22 Feb., 01:42, "Joseph Geretz" <jger...@nospam.comwrote:
More info:

I went into the proxy and hand coded it to:

public System.Data.DataTable GetUserProfile()
{
object[] results = this.Invoke("GetUserProfile", new object[0]);
return ((System.Data.DataTable)(results[0]));

}

But the next time I refresh the web service, it reverts back to:

public GetUserProfileResponseGetUserProfileResult GetUserProfile()
{
object[] results = this.Invoke("GetUserProfile", new object[0]);
return ((GetUserProfileResponseGetUserProfileResult)(resu lts[0]));

}

If I have to keep handcoding this every time I need to refresh the proxy
with the latest Web Service definitions, then this is a non-starter; I'll
have to go back to using a DataSet, rather than a DataTable.

Any idea what's going wrong here?

Thanks!

- Joseph Geretz -

"Joseph Geretz" <jger...@nospam.comwrote in message

news:OP**************@TK2MSFTNGP04.phx.gbl...
Hi Manish,
I am trying to do as you suggest, however for some reason, the proxy
doesn't seem to generate the proper return type.
Here's the Web Service Method:
[WebMethod]
[SoapHeader("m_Token", Direction = SoapHeaderDirection.InOut)]
public DataTable GetUserProfile()
Here's the line of code I use to call this method:
DataTable DT = (DataTable) m_ServerApp.GetUserProfile();
Here's the error which the compiler throws:
Cannot convert type
'WSAClient.ServerApp.GetUserProfileResponseGetUser ProfileResult' to
'System.Data.DataTable'
I don't get it. What sort of return type is
GetUserProfileResponseGetUserProfileResult? (BTW, the cast is irrelevant
to this question, without the cast I get 'cannot implicitly convert yada,
yada, yada'.)
BTW, the fellow here is experiencing the same issue, but I didn't see that
he got an answer.
http://www.thescripts.com/forum/thread430347.html
Anyone have the answer to this problem?
Thanks!
- Joseph Geretz -
"Manish Bafna" <ManishBa...@discussions.microsoft.comwrote in message
news:D0**********************************@microsof t.com...
Hi,
In .NET 2.0 even DataTable is serializable.
Thanks and Regards,
Manish Bafna.
MCP and MCTS.
"Joseph Geretz" wrote:
>I don't get it. A DataTable can't be returned, but a DataSet can. Yet a
DataSet contains one or more DataTables. So obviously a DataTable must
be
serializable. So why not just let me return a DataTable?
>Thanks for your advice,
>- Joe Geretz -
Hi Joe,

Did you ever find a solution? I am having the same problem and want to
avoid going to using a DataSet.

Thanks,
Rolf

Mar 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Millo | last post by:
Hi I'm trying to call the method Contains in a loop: out of the loop I set the primary key of the dataTable. The method returns true one time at a certani value, but then, when the loop steps...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
4
by: Tedmond | last post by:
Dear all, How to code a Web Service function that returns either a DataTable or DataReader to the clients? Or I should use other alternative? Thanks for any help! Tedmond
7
by: David P. Donahue | last post by:
My experience with databases using C# has been pretty limited thus far. Mostly I just use a SELECT statement to populate a DataSet, which is just read-only (mostly for display on a web page), or...
5
by: Jim Murphy | last post by:
In creating a C# web service, I am having trouble returning a DataTable object as the result of a web method. I have no problem returning native types like string or int, but cannot return a .NET...
9
by: jsoques | last post by:
Hello, I created a Web Service using .Net 2.0 that has a function that returns a DataTable. I can test the function from the web page when I access the .asmx from a browser on localhost and it...
3
by: szwejk | last post by:
Hi! I want to return DataTable from web service method. This method generate xml with schema and data. Is there any way to retrun more informations about columns? If I want to get maxLength...
5
by: Frank Hauptlorenz | last post by:
Hello, I recognized some days ago, that returning a DataTable blocks my WCF-Service. Is this a known bug? If I add this table to a new DataSet() and return this, it works. Thank you, Frank
2
by: Swys | last post by:
Hi all! I am creating a WCF service (my first). I am going to have a variety of clients, one of which is a PHP client. Now, I've already established that I can return a normal string to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.