473,533 Members | 2,780 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10205
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
17420
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 forward to check another value, the method returns false, although the value is contained in the dataTable (DateTime values). So the loop goes and...
0
2570
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 tablestyles to format any of the columns within the datagrid, the exception "Can-not parent objects created on one thread to objects created on...
4
2554
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
2628
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 maybe go so far as to build an UPDATE or INSERT query with a couple parameters and just execute it against the database. Currently, this is all done...
5
4959
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 DataTable object. The problem occurs when I try to compile the client side C# application (it complains about the DataTable type not being...
9
12001
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 works. I can also test the function using VB6 and the xmlhttp activex object. The problem I have now is when using VS 2005 or VB.Net 2005 Express and...
3
2281
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 there is no problem because DataColum has property MaxLength, but I need more (e.g. color, mask..) Thx for help! -- Szwejk
5
8617
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
4462
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 PHP client as wellas an array of strings. I also want to return a DataTable object in such a way that the PHP client will be able to understand the...
0
7359
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7528
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7677
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7270
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
570
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.