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.

Re: Repost: Problem Retrieving DataSet Returned By A WebService by Kathleen

Kathleen
Thu Jul 17 08:47:01 CDT 2003

BTW,

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

--
Kathleen (MVP-VB)



"Programatix" <programatix@nospam.com> wrote in message
news:eAWMmY#SDHA.2128@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" <kathleen@mvps.org> wrote in message
> news:O$7lFJ5SDHA.1324@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" <programatix@nospam.com> wrote in message
> > news:OzGgzehSDHA.3700@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.
> > >
> > >
> > >
> >
> >
>
>