Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Filling DataSet with XmlDataDocument (XmlNode) webservice

Filling DataSet with XmlDataDocument (XmlNode) webservice

Scheduled Pinned Locked Moved ASP.NET
database
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kapil Thakur
    wrote on last edited by
    #1

    A web service is returning data in XmlDataDocument format (XmlNode) to me. i want to fill a dataset with this returned data and then bind it to a datagrid. Here is the WebService : - _ Public Function LoadReport(ByVal Reporttype As String, ByVal CampaignID As String) As XmlDataDocument Dim _Connobj As New GTDatabaseComponent.GTDbManuplationSQLServer Dim _XmlDoc As XmlDataDocument Try Dim _sqlqry As String _Connobj.ConnectionString = GetDatabaseConnectionDetails() CampaignID = Trim(CampaignID) Reporttype = UCase(Trim(Reporttype)) If _Connobj.OpenConnection Then Select Case Reporttype Case UCase("Response") _sqlqry = "some query" Case UCase("Special") _sqlqry = "some query" Case UCase("UnProcessed") _sqlqry = "some query" End Select Dim objDataSet As New DataSet If _Connobj.ExecuteDataSet(_sqlqry, objDataSet, "_tblReport") = True Then _Connobj.CloseConnection() _Connobj = Nothing _XmlDoc = New XmlDataDocument _XmlDoc.LoadXml(objDataSet.GetXml) Return _XmlDoc End If End If Catch ex As Exception '_ErrorMessage = ex.Message Finally If Not _Connobj Is Nothing Then If _Connobj._IsValidConnection = True Then _Connobj.CloseConnection() _Connobj = Nothing End If _XmlDoc = Nothing End If End Try End Function Now the aspx page where i am using it shows its return type as XmlNode..... On the aspx page i am using the web service as : Dim ObjRS As New localService.Service Dim x As XmlNode = ObjRS.LoadReport(cmbReportType.SelectedItem.Value, Campaign.SelectedItem.Value) Now how should a fill a dataset through this.

    Y 1 Reply Last reply
    0
    • K Kapil Thakur

      A web service is returning data in XmlDataDocument format (XmlNode) to me. i want to fill a dataset with this returned data and then bind it to a datagrid. Here is the WebService : - _ Public Function LoadReport(ByVal Reporttype As String, ByVal CampaignID As String) As XmlDataDocument Dim _Connobj As New GTDatabaseComponent.GTDbManuplationSQLServer Dim _XmlDoc As XmlDataDocument Try Dim _sqlqry As String _Connobj.ConnectionString = GetDatabaseConnectionDetails() CampaignID = Trim(CampaignID) Reporttype = UCase(Trim(Reporttype)) If _Connobj.OpenConnection Then Select Case Reporttype Case UCase("Response") _sqlqry = "some query" Case UCase("Special") _sqlqry = "some query" Case UCase("UnProcessed") _sqlqry = "some query" End Select Dim objDataSet As New DataSet If _Connobj.ExecuteDataSet(_sqlqry, objDataSet, "_tblReport") = True Then _Connobj.CloseConnection() _Connobj = Nothing _XmlDoc = New XmlDataDocument _XmlDoc.LoadXml(objDataSet.GetXml) Return _XmlDoc End If End If Catch ex As Exception '_ErrorMessage = ex.Message Finally If Not _Connobj Is Nothing Then If _Connobj._IsValidConnection = True Then _Connobj.CloseConnection() _Connobj = Nothing End If _XmlDoc = Nothing End If End Try End Function Now the aspx page where i am using it shows its return type as XmlNode..... On the aspx page i am using the web service as : Dim ObjRS As New localService.Service Dim x As XmlNode = ObjRS.LoadReport(cmbReportType.SelectedItem.Value, Campaign.SelectedItem.Value) Now how should a fill a dataset through this.

      Y Offline
      Y Offline
      yogsworld
      wrote on last edited by
      #2

      HI try this code code details --- emp.GetUserDetails(Convert.ToInt32((txtemp.Text))); web service function returning xmlNode ; DataSet ds = new DataSet(); XmlNode xml; xml=emp.GetUserDetails(Convert.ToInt32((txtemp.Text))); XmlNodeReader reader = new XmlNodeReader(xml); ds.ReadXml(reader); // u can use this dataset to bind datagrid Yogesh Mahajan

      K 1 Reply Last reply
      0
      • Y yogsworld

        HI try this code code details --- emp.GetUserDetails(Convert.ToInt32((txtemp.Text))); web service function returning xmlNode ; DataSet ds = new DataSet(); XmlNode xml; xml=emp.GetUserDetails(Convert.ToInt32((txtemp.Text))); XmlNodeReader reader = new XmlNodeReader(xml); ds.ReadXml(reader); // u can use this dataset to bind datagrid Yogesh Mahajan

        K Offline
        K Offline
        Kapil Thakur
        wrote on last edited by
        #3

        thanks Mr. Yogesh.your example is absolutely fine.its working well.thanks.you've been of great help.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups