473,399 Members | 3,656 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,399 software developers and data experts.

Repost: Problem Retrieving DataSet Returned By A WebService

Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset
returned contain errors (marked by calling the SetColumnError() method or
setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.

Nov 17 '05 #1
1 1206
BTW,

Thanks for the great repro, and I'm sorry I looked at it too lightly
yesterday.

--
Kathleen (MVP-VB)

"Programatix" <pr*********@nospam.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
Yes, it's an exception. There shouldn't be any exception. In the catch
section, there is nothing I can do.

If forcing the Windows Form application to run in .NET Framework 1.0, there isn't any exception at all.

"Kathleen Dollard" <ka******@mvps.org> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
The "message" you receive is an exception? Is the dataset correct? I think
this is just extra informatoin and you just need to do something like

Try
' Get WebService Data
Catch
' Do we care?
End Try

Kathleen
"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data
from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or setting the RowError property of the DataRow), I get the following

error message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid

control (assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.



Nov 17 '05 #2

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

Similar topics

0
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
6
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.