D
Derek Correia
Hello,
I'm just getting started with web services. I've written one that takes
an integer and searches an Oracle database for that customer ID. I want
it to return all records with that customer ID. Below is the code of
the ASMX page:
---------------
<%@ WebService Language="VB" Class="WebCenter" %>
Imports System.Web.Services
Imports System.Data
Imports System.Data.OracleClient
Imports System.Configuration
Public Class WebCenter
Private Function GetDataSet(strSQL as String) as DataSet
Dim oraConn As OracleConnection = New OracleConnection("Data
Source=ORASRV;Integrated
Security=no;user=WEBSERVICE;password=WEBSERVICE;")
Dim oraCMD As OracleCommand = New OracleCommand(strSQL , oraConn)
oraConn.Open()
Dim myDataAdapter as OracleDataAdapter
myDataAdapter.SelectCommand = oraCMD
Dim myDataSet as New DataSet()
myDataAdapter.Fill(myDataSet)
oraConn.Close()
Return myDataSet
End Function
<WebMethod()> Public Function FindMember(memid as Integer) as
DataSet
dim strSQL as string
strSQL = "SELECT * FROM DW_USERS where SUBSCRIBER_ID=" & memid
Return GetDataSet(strSQL)
End Function
End Class
------------
When testing the above code using HTTP get from the localhost, I get
the following error:
System.NullReferenceException: Object reference not set to an instance
of an object.
at WebCenter.GetDataSet(String strSQL)
at WebCenter.FindMember(Int32 memid)
Is there something I am doing wrong? This is on a Windows 2k server
with .Net framework 1.1 installed. Thank you.
-Derek
I'm just getting started with web services. I've written one that takes
an integer and searches an Oracle database for that customer ID. I want
it to return all records with that customer ID. Below is the code of
the ASMX page:
---------------
<%@ WebService Language="VB" Class="WebCenter" %>
Imports System.Web.Services
Imports System.Data
Imports System.Data.OracleClient
Imports System.Configuration
Public Class WebCenter
Private Function GetDataSet(strSQL as String) as DataSet
Dim oraConn As OracleConnection = New OracleConnection("Data
Source=ORASRV;Integrated
Security=no;user=WEBSERVICE;password=WEBSERVICE;")
Dim oraCMD As OracleCommand = New OracleCommand(strSQL , oraConn)
oraConn.Open()
Dim myDataAdapter as OracleDataAdapter
myDataAdapter.SelectCommand = oraCMD
Dim myDataSet as New DataSet()
myDataAdapter.Fill(myDataSet)
oraConn.Close()
Return myDataSet
End Function
<WebMethod()> Public Function FindMember(memid as Integer) as
DataSet
dim strSQL as string
strSQL = "SELECT * FROM DW_USERS where SUBSCRIBER_ID=" & memid
Return GetDataSet(strSQL)
End Function
End Class
------------
When testing the above code using HTTP get from the localhost, I get
the following error:
System.NullReferenceException: Object reference not set to an instance
of an object.
at WebCenter.GetDataSet(String strSQL)
at WebCenter.FindMember(Int32 memid)
Is there something I am doing wrong? This is on a Windows 2k server
with .Net framework 1.1 installed. Thank you.
-Derek