I'm working on a really simple web service and hoping to get some help. I took the stock web service from Visual Studio, and started modifying it with very limited knowledge of ODP.NET. Effectively, what I'm trying to do is bring back a set of results from a SQL Query that has a variable in it that I pass to the service. WR_Premise is the variable that I'd like to incorporate, after I get my query working correctly. I call my function using the WCF Test client, but am getting a InvalidOperationException when I try to run the following code.
I can get the service to work and return the states when I take the command.ExecuteNonQuery() out of the service, but that doesn't help me out much... Also, anyone know an easy way to output the results to XML?`Public Function GetData(ByVal value As Integer) As String Implements IService1.GetData
Dim wrpremise As Integer
Dim state As String
Dim queryString As String = _ "select MV_OUTAGE_DURATION.CAUSE_DESC, MV_OUTAGE_DURATION.DEV_NAME, MV_OUTAGE_DURATION.DEV_TYPE_NAME, MV_OUTAGE_DURATION.EVENTNUM, MV_OUTAGE_DURATION.OUT_MINUTES, MV_OUTAGE_DURATION.OFF_DTS , MV_OUTAGE_DURATION.RESTORE_DTS , MV_OUTAGE_DURATION.SYS_RESP_TYPE from MV_we_outage_premise, MV_OUTAGE_DURATION where mv_we_outage_premise.evntnum = MV_OUTAGE_DURATION.eventnum and mv_we_outage_premise.we_premise = '995184' order by(MV_OUTAGE_DURATION.RESTORE_DTS)"
Dim command As New OracleCommand(queryString) value = wrpremise
Dim oradb As String = "Data Source=****;User Id=******;Password=***********;"
Dim conn As New OracleConnection(oradb)
conn.Open()
state = conn.State.ToString()
command.ExecuteNonQuery()
MsgBox(state)
conn.Close()
state = conn.State.ToString()
MsgBox(state)
Return String.Format("You entered: {0}", value)End Function`