I need to generate an XML file in my web service function, I did a little testing: to select a table from database & save in XML format, this is my code:
Expand|Select|Wrap|Line Numbers
- <WebMethod()> Public Sub myTest()
- Dim cn As OdbcConnection
- Dim myDataAdapter As OdbcDataAdapter
- Dim myDataset As DataSet
- Dim cmdString As String
- cmdString = "select * from myTable"
- cn = New OdbcConnection("DSN=mydsn;srvr=myserver;DB=mydatabase;UID=sa;PWD=sa")
- myDataAdapter = New OdbcDataAdapter(cmdString, cn)
- myDataset = New DataSet
- myDataAdapter.Fill(myDataset, "triage")
- myDataset.WriteXml(HttpContext.Current.Server.MapPath("test.xml"))
- End Sub
"c:\inetpub\wwwroot\WebServTest\test.xml" is denied.
But when I use the same code for normal webform, it works & create the test.xml for me.
so what is my problem here??? please help!
thanks
Twee