Problem with WebService when setting rows with error

P

Programatix

Hi,

I upgraded my application from dotNetFramework 1.0 to dotNetFramework 1.1

When calling a WebService method which returns a dataset, I get the
following error,
"There is an error in XML doument (1,xxxxxxx)"

This error will be displayed if I use the following method for any datarow
contained in the dataset,
RowError
SetColumnError

May I know what went wrong.

Thanks.
 
P

Programatix

Hi,

I've written a sample code for the WebService. Can anyone try it out?

<WebMethod()> Public Function GetTest() 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



The following the is code that should be located in the Window Form
application
Dim ws As SSM.WebServices.BookServiceSoap

Dim ds As DataSet

Try

ws = New SSM.WebServices.BookServiceSoap ' This should be the WebService
reference

ws.Credentials = System.Net.CredentialCache.DefaultCredentials



' Exception will be thrown when ws.GetTest returns

ds = ws.GetTest

Catch ex As Exception

MsgBox(ex.Message)

Finally

ws.Dispose()

End Try



Please help me out.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top