VBAHole22 Posted November 19, 2003 Posted November 19, 2003 When I try to pass the contents of a dataset to a webservice using XML I get an error saying the content is too large (260 limit or something) so I trimmed it down and now it says that it has illegal characters. I tried to convert it to Byte but that didn't work out either it still says illegal characters. How can you transfer the contents of a dataset across space and time and have it come out on the other end with some semblence of what it once was? Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted November 20, 2003 Administrators Posted November 20, 2003 How are you converting the dataset to XML? Any chance of the exact error message? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
VBAHole22 Posted November 20, 2003 Author Posted November 20, 2003 I messed around with the XML for a while and didn't get it to fly. At first the error was the length was to long then I shrunk the dataset and the error was illegal charcters. then tried to convert it to bytes and that gave me illegal characters also. The I realized you can just pass datasets Now the error appears to be in the update clause I am using. Will post the code tomorrow. All of the samples I read they populate a dataset and then a datatable with a select statement. Well I already have my dataset so I don't need the select I suppose. I started getting an error that said the dynamicSQL couldn't create the update clause automatically but I got around that. Now it says something about SelectCommand.connection has to be initialized. Quote Wanna-Be C# Superstar
Mehyar Posted November 20, 2003 Posted November 20, 2003 Why are you passing the dataset as XMl, why don't you pass it as a dataset and then if u need the xml there convert it in the service ?? Quote Dream as if you'll live forever, live as if you'll die today
VBAHole22 Posted November 20, 2003 Author Posted November 20, 2003 I didn't realize that you could move datasets like that but now that I do I gave it a try. My error message says that I need to initialize DataAdapter.SelectCommand.Connection Don't have any idea what that means? Here is the code that calls the service: Module SerializeMembers Const strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = C:\AT.mdb" Public Function SubmitToService() As String Dim objConn As New OleDbConnection(strConn) Try objConn.Open() Dim strSQL As String = "SELECT * FROM Assets ORDER BY DateTime DESC" Dim dadMembers As New OleDbDataAdapter(strSQL, objConn) Dim dstMembers As New DataSet dadMembers.Fill(dstMembers, "Assets") Dim obj As New XMLTesting.ti.Service1 Catch ex As OleDbException Console.WriteLine(ex.Message) Finally objConn.Close() End Try End Function End Module And here is the code for the service itself: <System.Web.Services.WebService(Namespace := "http://tempuri.org/AssetService/Service1")> _ Public Class Service1 Inherits System.Web.Services.WebService #Region " Web Services Designer Generated Code " Public Sub New() MyBase.New() 'This call is required by the Web Services Designer. InitializeComponent() 'Add your own initialization code after the InitializeComponent() call End Sub 'Required by the Web Services Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Web Services Designer 'It can be modified using the Web Services Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) 'CODEGEN: This procedure is required by the Web Services Designer 'Do not modify it using the code editor. If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub #End Region <WebMethod(Description:="This Function Accepts a dataset that is sent by the client")> _ Public Function GetAssetData(ByVal strXML As DataSet) As String Dim dstAsset As New DataSet dstAsset = strXML Dim dtbAssets As DataTable Dim objCommandbuilder As New OleDbCommandBuilder Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = C:\Mo.mdb" Dim objConn As New OleDbConnection(strConn) Try Dim strSQL As String = "SELECT ID, X, Y, Status, Transmitted, DateTime From ASSETS" objConn.Open() Dim objCommand As New OleDbCommand(strSQL, objConn) Dim dadMembers As New OleDbDataAdapter Dim dstAssetSelect As DataSet dadMembers.SelectCommand = objCommand 'Filling the data table first but I don't know why dadMembers.Fill(dstAssetSelect, "Assets") dtbAssets = dstAsset.Tables("Assets") objCommandbuilder = New OleDbCommandBuilder(dadMembers) dadMembers.Update(dstAsset, "Assets") Return "Got IT" Catch ex As OleDbException Console.WriteLine(ex.Message) Return ex.Message Finally objConn.Close() End Try Return "Got the data" End Function End Class Quote Wanna-Be C# Superstar
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.