Filling DataSet with XmlDataDocument (XmlNode) webservice
-
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.
-
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.
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
-
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
thanks Mr. Yogesh.your example is absolutely fine.its working well.thanks.you've been of great help.