473,395 Members | 1,681 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,395 software developers and data experts.

How to pass a typed dataset to a web service

I'm having a type mismatch problem when trying to pass a typed dataset to a
web service.

My code is:

CLIENT CODE

I have a dataset schema file called MainData.xsd containing a table called
mytable

'create and fill typed dataset
Dim dsMain As New MainData
Dim con As New SqlConnection("myconnectionstring")
Dim da As New SqlDataAdapter("select * .....", con)
da.Fill(dsMain.mytable)

'pass typed dataset to web service
Dim ws As New localhost.DataTransfer
ws.PassData(dsMain)

WEB SERVICE CODE

The web service also has an identical local file containing the data schema
called MainData.xsd

<WebMethod()> Public function PassData(Value as MainData)
....
End Function
Unfortunately I get an error when I hover over the PassData method that says
'Value of Type MainData cannot be converted to localhost.MainData'.

It is obviously treating the two data types as being different.

If I change the parameter type of the PassData function to type DataSet then
the function can be called OK, but then I lose the type information.

Any ideas anybody?

Thanks

Justin Crossley
Nov 21 '05 #1
1 4465
Justin Crossley wrote:
I'm having a type mismatch problem when trying to pass a typed dataset
to a web service.

... code snipped for brevity ...

Unfortunately I get an error when I hover over the PassData method
that says 'Value of Type MainData cannot be converted to
localhost.MainData'.

It is obviously treating the two data types as being different.
It's because they are two different data types as far as .NET knows. Even though the MainData you have generated on the client is logically the same because it was generated from the same XSD, it's not the same .NET type. So you have to use the MainData class generated by the web reference.
If I change the parameter type of the PassData function to type
DataSet then the function can be called OK, but then I lose the type
information.


Yeah, you shouldn't have to go this route though. It's less type specific and what you're doing is a perfectly viable solution. I think you're just getting confused by .NET typing vs. XSD typing.

HTH,
Drew
Nov 21 '05 #2

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

Similar topics

0
by: Bj?rn Mor?n | last post by:
I am consuming a web service that returns arrays of classes which can contain other classes (a hierarchy of data). Is there a simple way to move the data into a typed DataSet without writing too...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
12
by: Whoever | last post by:
Hi, I'm trying to return an XmlDocument or XmlNode converted from a typed dataset. public XmlNode whatever() { MyTypedDataSet ds = new MyTypedDataSet(); return new XmlDataDocument(ds); }
2
by: Anil Pundhir | last post by:
What is the best way to pass data to a web service. The client(to send data) has .net environment and also the server on which the web service is hosted also has the .net environment. Should I...
1
by: Steve | last post by:
I have a windows CE application, talking to a C# WebService. In the WebService project I have created a dataset (dsJobList), and there is a web method in there which returns a fully loaded...
2
by: Deecrypt | last post by:
Hi, I'm a newbie to the Web Services topic. I have an ASP.NET website and am trying to send a Dataset from it to a WebService which should insert all the data from this DataSet to an Access...
3
by: Mike | last post by:
Hi, I'm delevloping a webservice that returns typed datasets with visual studio 2005. The problem is, that the typed data set in the client app is not the same as in the webservice. If I change...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
7
by: =?Utf-8?B?TWF4R3J1dmVu?= | last post by:
I have a DLL that implements the Business and Data Layers for a number of different websites. That DLL uses a Strongly Typed DataSet to interface to the Data Source which is SQL Server. There...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
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...
0
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...

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.