473,574 Members | 3,158 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 10210
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_T oken", Direction = SoapHeaderDirec tion.InOut)]
public DataTable GetUserProfile( )

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

DataTable DT = (DataTable) m_ServerApp.Get UserProfile();

Here's the error which the compiler throws:

Cannot convert type
'WSAClient.Serv erApp.GetUserPr ofileResponseGe tUserProfileRes ult' to
'System.Data.Da taTable'

I don't get it. What sort of return type is
GetUserProfileR esponseGetUserP rofileResult? (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*********@di scussions.micro soft.comwrote in message
news:D0******** *************** ***********@mic rosoft.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.Dat aTable GetUserProfile( )
{
object[] results = this.Invoke("Ge tUserProfile", new object[0]);
return ((System.Data.D ataTable)(resul ts[0]));
}

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

public GetUserProfileR esponseGetUserP rofileResult GetUserProfile( )
{
object[] results = this.Invoke("Ge tUserProfile", new object[0]);
return ((GetUserProfil eResponseGetUse rProfileResult) (results[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******** ******@TK2MSFTN GP04.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_T oken", Direction = SoapHeaderDirec tion.InOut)]
public DataTable GetUserProfile( )

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

DataTable DT = (DataTable) m_ServerApp.Get UserProfile();

Here's the error which the compiler throws:

Cannot convert type
'WSAClient.Serv erApp.GetUserPr ofileResponseGe tUserProfileRes ult' to
'System.Data.Da taTable'

I don't get it. What sort of return type is
GetUserProfileR esponseGetUserP rofileResult? (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*********@di scussions.micro soft.comwrote in message
news:D0******** *************** ***********@mic rosoft.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
serializabl e. 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.Dat aTable GetUserProfile( )
{
object[] results = this.Invoke("Ge tUserProfile", new object[0]);
return ((System.Data.D ataTable)(resul ts[0]));

}

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

public GetUserProfileR esponseGetUserP rofileResult GetUserProfile( )
{
object[] results = this.Invoke("Ge tUserProfile", new object[0]);
return ((GetUserProfil eResponseGetUse rProfileResult) (results[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******** ******@TK2MSFTN GP04.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_T oken", Direction = SoapHeaderDirec tion.InOut)]
public DataTable GetUserProfile( )
Here's the line of code I use to call this method:
DataTable DT = (DataTable) m_ServerApp.Get UserProfile();
Here's the error which the compiler throws:
Cannot convert type
'WSAClient.Serv erApp.GetUserPr ofileResponseGe tUserProfileRes ult' to
'System.Data.Da taTable'
I don't get it. What sort of return type is
GetUserProfileR esponseGetUserP rofileResult? (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...@di scussions.micro soft.comwrote in message
news:D0******** *************** ***********@mic rosoft.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
17425
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
2579
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
2565
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
2631
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
4963
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
12008
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
2287
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
8626
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
4464
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
7843
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
7764
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8111
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
8274
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...
0
8140
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
6514
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
3776
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.