M
Mark B
This code is returning a HTPP Internal Server Error.
How do I amend it to:
a) Create an XML file on the server
b) Return a XML stream to the person who called the webservice?
<System.Web.Services.WebMethod()> _
Public Function WsTableValuesGet( _
ByVal strPlatform As String _
) As String
Dim sqlConnection1 As New SqlConnection(GetConnectionString())
Dim cmd As New SqlCommand
Dim ds As New DataSet
cmd.Connection = sqlConnection1
cmd.CommandText = "uspServicesTableValuesGet"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@EnterPlatform", strPlatform)
Try
sqlConnection1.Open()
ds.DataSetName = "XMLData"
ds.Load(cmd.ExecuteReader(), LoadOption.OverwriteChanges,
"XMLData")
ds.WriteXml("MyNewXMLFile.xml", XmlWriteMode.IgnoreSchema)
Catch ex As SqlException
Throw ex
Finally
sqlConnection1.Close()
sqlConnection1.Dispose()
cmd.Dispose()
End Try
End Function
How do I amend it to:
a) Create an XML file on the server
b) Return a XML stream to the person who called the webservice?
<System.Web.Services.WebMethod()> _
Public Function WsTableValuesGet( _
ByVal strPlatform As String _
) As String
Dim sqlConnection1 As New SqlConnection(GetConnectionString())
Dim cmd As New SqlCommand
Dim ds As New DataSet
cmd.Connection = sqlConnection1
cmd.CommandText = "uspServicesTableValuesGet"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@EnterPlatform", strPlatform)
Try
sqlConnection1.Open()
ds.DataSetName = "XMLData"
ds.Load(cmd.ExecuteReader(), LoadOption.OverwriteChanges,
"XMLData")
ds.WriteXml("MyNewXMLFile.xml", XmlWriteMode.IgnoreSchema)
Catch ex As SqlException
Throw ex
Finally
sqlConnection1.Close()
sqlConnection1.Dispose()
cmd.Dispose()
End Try
End Function