By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

Repost: Problem Retrieving DataSet Returned By A WebService

P: n/a
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.

Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures in
the database. Dataset worked fine as long as it was not returned through a
web service. When used in a web service, if I cleared all row errors, then
no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"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.

Jul 19 '05 #2

P: n/a
At last, I'm not alone. So far, you're the third person I've known to notice
this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures in the database. Dataset worked fine as long as it was not returned through a
web service. When used in a web service, if I cleared all row errors, then
no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"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.


Jul 19 '05 #3

P: n/a
I believe that it is a bug. As I mentioned, I think it is a problem with
serialization when the typed dataset contains row errors and is being
returned by a web service method. If I cleared the errors, then the same
function works fine.
Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
At last, I'm not alone. So far, you're the third person I've known to notice this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures
in
the database. Dataset worked fine as long as it was not returned through

a web service. When used in a web service, if I cleared all row errors, then no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"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.



Jul 19 '05 #4

P: n/a
Since marking the rows with error is important to me. Do you have any
solution? I need to receive the rows with errors.

"RogerS" <no****@hotmail.com> wrote in message
news:O5****************@TK2MSFTNGP12.phx.gbl...
I believe that it is a bug. As I mentioned, I think it is a problem with
serialization when the typed dataset contains row errors and is being
returned by a web service method. If I cleared the errors, then the same
function works fine.
Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
At last, I'm not alone. So far, you're the third person I've known to notice
this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying to utilize rowerrors to set/retrieve error codes/messages from procedures
in
the database. Dataset worked fine as long as it was not returned through a web service. When used in a web service, if I cleared all row errors, then no problem but if I set one, then I got the same basic problem you
have mentioned (error in xml). It almost has to be a serialization issue.

Roger

"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.
>
>
>



Jul 19 '05 #5

P: n/a
The following it the text of the error I receive:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There is an error in XML document (1, 132741).

The inner exception reads as follows:

"System.NullReferenceException: Object reference not set to an instance of
an object.
at System.Xml.Serialization.XmlSerializationReader.Un knownNode(XmlNode
unknownNode, Object o)
at System.Xml.Serialization.XmlSerializationReader.Un knownNode(Object o)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_
getDatasetResponse()"

If I comment out the following line in the function that returns the
dataset:

ds.States(0).SetColumnError(0, "My row error") ' set error on first row

then it all works fine but if I put this line back in then the error above
occurs. I tried, as you suggested, to eat the exception in a try/catch but
the dataset is not returned. Again, this only seems to be a problem with the
dataset is returned from a webservice call.

I do appreciate you looking at this, Kathleen. I have since worked around my
problem but I think this is something that needs attention and should be
addressed. I had to change the design of a DataAccessLayer for a fairly
large enterprise application when I hit this wall as I was initially using
row errors to return custom messages from stored procs.

Roger


"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.


Jul 19 '05 #6

P: n/a
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.



Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.