469,352 Members | 2,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

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 9939
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Millo | last post: by
7 posts views Thread by David P. Donahue | last post: by
9 posts views Thread by jsoques | last post: by
5 posts views Thread by Frank Hauptlorenz | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.