Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Dataset retunring Null ..a guru's opinion required!

Reply
Thread Tools

Dataset retunring Null ..a guru's opinion required!

 
 
Nab
Guest
Posts: n/a
 
      09-11-2008
I hope someone could shed some light on this issue. Is this relating to some
“bug” in Visual Basic 2008 or am I doing something wrong here? I have
established a connection to a Microsoft Access database using the GUI
e.g. dragging the OleDbConnection icon on the
toolbox to the design area to establish the connection (i.e. not in code).
This process creates a connection object and an OleDbAdapter object (which I
named estateOleAdapter as you can see in my web service’s code):

<WebMethod()> _
Public Function GetEstateAgents() As DataSet
Dim estateDataset As DataSet = New DataSet
estateOleAdapter.Fill(estateDataset, "EstateAgents")
Return estateDataset
estateOleConnection.Close()
End Function

I also tried
to establish the connection and adapter in code but continue to have the same
problem.

Whenever I try to consume this service (using a web or even a windows
application this exception comes up):

System.ServiceModel.FaultException was unhandled by user code
Message="System.Web.Services.Protocols.SoapExcepti on: Server was unable to
process request. ---> System.NullReferenceException: Object reference not set
to an instance of an object. at
WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
C:\Hope\modules i teach\web services\handout
exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts\WebServiceLiverpoolUKEstateAgents\LiverpoolUKEs tateAgents.asmx.vb:line
29 --- End of inner exception stack trace ---"
Source="mscorlib"
StackTrace:
Server stack trace: at
System.ServiceModel.Channels.ServiceChannel.Handle Reply(ProxyOperationRuntime
operation, ProxyRpc& rpc) at
System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at
System.ServiceModel.Channels.ServiceChannelProxy.I nvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.I nvoke(IMessage message)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData& msgData,
Int32 type) at
ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1Soap.GetEstateAgents()
at
ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1SoapClient.GetEstateAgents()
in C:\Hope\modules i teach\web services\handout
exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Service
References\WebServiceLiverpoolUKEstateAgents\Refer ence.vb:line 59 at
ClientLiverpoolUKEstateAgents._Default.form1_Load( Object sender, EventArgs e)
in C:\Hope\modules i teach\web services\handout
exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Default.aspx.vb:line
19 at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)
InnerException:

This is the code (inserted in a command’s click procedure) that I used to
consume the service:

Dim eaService As New WebServiceLiverpoolUKEstateAgents.Service1SoapClie nt

'Supply the dataset to become the DataGrid's datasource
'dgEstateAgents.DataSource = eaService.GetEstateAgents

dgEstateAgents.DataSource = eaService.GetEstateAgents

'Bind the data to the datagrid by transferring
'it from the dataset to the datagrid

dgEstateAgents.DataBind()

The dgEstateAgents is the name of the datagrid which I created using the
GUI. When adding a reference, I tried “Add Service Reference” and I also
tried “Add Web Reference”, neither worked.

To ensure that my web service is well connected to my Access database, I
would sometimes click on the Data icon on the menu bar and select Preview
Data and then click to populate the dataset. Sometimes this results in the
display of the database’s table. However, when I try to do same thing other
times I get a window that says: "Value cannot be null. Parameter name:
serviceProvider" which leads me to conclude that the dataset is empty. If I
close that web service and relaunch it I don’t get this "Value cannot be
null. Parameter name: serviceProvider" error!!


In either case, my client application halts on this line
dgEstateAgents.DataSource = eaService.GetEstateAgents
every time I try to consume the service and throws the exception listed above.

The operation system I use is Vista (business edition).

When I used VS 2005 in the past I had no such errors and the web service was
consumed without any problems. So, I am really clueless here!





--
UK
 
Reply With Quote
 
 
 
 
Nab
Guest
Posts: n/a
 
      09-11-2008
Thanks Patrice. The estateOleAdapter is created automatically (I renamed it
estateOleAdapter) when the connection was created using the GUI. You're right
to say its "Nothing" as when I debug the client "Nothing" is shown as the
returned value. So, what do you suggest should be done and why did this
problem not surface when I used VB005?
--
UK


"Patrice" wrote:

> How is estateOleAdapter initialized ?
>
> My guess is that this is Nothing so you have a null reference exception when
> you call this web method...
>
> --
> Patrice
>
> "Nab" <(E-Mail Removed)> a crit dans le message de groupe de
> discussion : http://www.velocityreviews.com/forums/(E-Mail Removed)...
> > I hope someone could shed some light on this issue. Is this relating to
> > some
> > "bug" in Visual Basic 2008 or am I doing something wrong here? I have
> > established a connection to a Microsoft Access database using the GUI
> > e.g. dragging the OleDbConnection icon on the
> > toolbox to the design area to establish the connection (i.e. not in code).
> > This process creates a connection object and an OleDbAdapter object (which
> > I
> > named estateOleAdapter as you can see in my web service's code):
> >
> > <WebMethod()> _
> > Public Function GetEstateAgents() As DataSet
> > Dim estateDataset As DataSet = New DataSet
> > estateOleAdapter.Fill(estateDataset, "EstateAgents")
> > Return estateDataset
> > estateOleConnection.Close()
> > End Function
> >
> > I also tried
> > to establish the connection and adapter in code but continue to have the
> > same
> > problem.
> >
> > Whenever I try to consume this service (using a web or even a windows
> > application this exception comes up):
> >
> > System.ServiceModel.FaultException was unhandled by user code
> > Message="System.Web.Services.Protocols.SoapExcepti on: Server was unable
> > to
> > process request. ---> System.NullReferenceException: Object reference not
> > set
> > to an instance of an object. at
> > WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
> > C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts\WebServiceLiverpoolUKEstateAgents\LiverpoolUKEs tateAgents.asmx.vb:line
> > 29 --- End of inner exception stack trace ---"
> > Source="mscorlib"
> > StackTrace:
> > Server stack trace: at
> > System.ServiceModel.Channels.ServiceChannel.Handle Reply(ProxyOperationRuntime
> > operation, ProxyRpc& rpc) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
> > TimeSpan timeout) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
> > at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvokeService(IMethodCallMessage
> > methodCall, ProxyOperationRuntime operation) at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvoke(IMessage message)
> > Exception rethrown at [0]: at
> > System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
> > reqMsg, IMessage retMsg) at
> > System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
> > msgData,
> > Int32 type) at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1Soap.GetEstateAgents()
> > at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1SoapClient.GetEstateAgents()
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Service
> > References\WebServiceLiverpoolUKEstateAgents\Refer ence.vb:line 59 at
> > ClientLiverpoolUKEstateAgents._Default.form1_Load( Object sender, EventArgs
> > e)
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Default.aspx.vb:line
> > 19 at System.Web.UI.Control.OnLoad(EventArgs e) at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint,
> > Boolean includeStagesAfterAsyncPoint)
> > InnerException:
> >
> > This is the code (inserted in a command's click procedure) that I used to
> > consume the service:
> >
> > Dim eaService As New WebServiceLiverpoolUKEstateAgents.Service1SoapClie nt
> >
> > 'Supply the dataset to become the DataGrid's datasource
> > 'dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > 'Bind the data to the datagrid by transferring
> > 'it from the dataset to the datagrid
> >
> > dgEstateAgents.DataBind()
> >
> > The dgEstateAgents is the name of the datagrid which I created using the
> > GUI. When adding a reference, I tried "Add Service Reference" and I also
> > tried "Add Web Reference", neither worked.
> >
> > To ensure that my web service is well connected to my Access database, I
> > would sometimes click on the Data icon on the menu bar and select Preview
> > Data and then click to populate the dataset. Sometimes this results in
> > the
> > display of the database's table. However, when I try to do same thing
> > other
> > times I get a window that says: "Value cannot be null. Parameter name:
> > serviceProvider" which leads me to conclude that the dataset is empty. If
> > I
> > close that web service and relaunch it I don't get this "Value cannot be
> > null. Parameter name: serviceProvider" error!!
> >
> >
> > In either case, my client application halts on this line
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> > every time I try to consume the service and throws the exception listed
> > above.
> >
> > The operation system I use is Vista (business edition).
> >
> > When I used VS 2005 in the past I had no such errors and the web service
> > was
> > consumed without any problems. So, I am really clueless here!
> >
> >
> >
> >
> >
> > --
> > UK

>
>

 
Reply With Quote
 
 
 
 
Nab
Guest
Posts: n/a
 
      09-11-2008
I deleted the oleadapter created by the GUI and declared it in code e.g.:
Dim estateOleAdapter As New OleDbDataAdapter

and updated the service reference in the client..but the same exception is
still thrown. Could you possibly test this scenario on your PC (if you have
VS200? Remember that the web service is connected to an Access (not SQL
Server) database?
UK


"Patrice" wrote:

> How is estateOleAdapter initialized ?
>
> My guess is that this is Nothing so you have a null reference exception when
> you call this web method...
>
> --
> Patrice
>
> "Nab" <(E-Mail Removed)> a crit dans le message de groupe de
> discussion : (E-Mail Removed)...
> > I hope someone could shed some light on this issue. Is this relating to
> > some
> > "bug" in Visual Basic 2008 or am I doing something wrong here? I have
> > established a connection to a Microsoft Access database using the GUI
> > e.g. dragging the OleDbConnection icon on the
> > toolbox to the design area to establish the connection (i.e. not in code).
> > This process creates a connection object and an OleDbAdapter object (which
> > I
> > named estateOleAdapter as you can see in my web service's code):
> >
> > <WebMethod()> _
> > Public Function GetEstateAgents() As DataSet
> > Dim estateDataset As DataSet = New DataSet
> > estateOleAdapter.Fill(estateDataset, "EstateAgents")
> > Return estateDataset
> > estateOleConnection.Close()
> > End Function
> >
> > I also tried
> > to establish the connection and adapter in code but continue to have the
> > same
> > problem.
> >
> > Whenever I try to consume this service (using a web or even a windows
> > application this exception comes up):
> >
> > System.ServiceModel.FaultException was unhandled by user code
> > Message="System.Web.Services.Protocols.SoapExcepti on: Server was unable
> > to
> > process request. ---> System.NullReferenceException: Object reference not
> > set
> > to an instance of an object. at
> > WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
> > C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts\WebServiceLiverpoolUKEstateAgents\LiverpoolUKEs tateAgents.asmx.vb:line
> > 29 --- End of inner exception stack trace ---"
> > Source="mscorlib"
> > StackTrace:
> > Server stack trace: at
> > System.ServiceModel.Channels.ServiceChannel.Handle Reply(ProxyOperationRuntime
> > operation, ProxyRpc& rpc) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
> > TimeSpan timeout) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
> > at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvokeService(IMethodCallMessage
> > methodCall, ProxyOperationRuntime operation) at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvoke(IMessage message)
> > Exception rethrown at [0]: at
> > System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
> > reqMsg, IMessage retMsg) at
> > System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
> > msgData,
> > Int32 type) at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1Soap.GetEstateAgents()
> > at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1SoapClient.GetEstateAgents()
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Service
> > References\WebServiceLiverpoolUKEstateAgents\Refer ence.vb:line 59 at
> > ClientLiverpoolUKEstateAgents._Default.form1_Load( Object sender, EventArgs
> > e)
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Default.aspx.vb:line
> > 19 at System.Web.UI.Control.OnLoad(EventArgs e) at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint,
> > Boolean includeStagesAfterAsyncPoint)
> > InnerException:
> >
> > This is the code (inserted in a command's click procedure) that I used to
> > consume the service:
> >
> > Dim eaService As New WebServiceLiverpoolUKEstateAgents.Service1SoapClie nt
> >
> > 'Supply the dataset to become the DataGrid's datasource
> > 'dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > 'Bind the data to the datagrid by transferring
> > 'it from the dataset to the datagrid
> >
> > dgEstateAgents.DataBind()
> >
> > The dgEstateAgents is the name of the datagrid which I created using the
> > GUI. When adding a reference, I tried "Add Service Reference" and I also
> > tried "Add Web Reference", neither worked.
> >
> > To ensure that my web service is well connected to my Access database, I
> > would sometimes click on the Data icon on the menu bar and select Preview
> > Data and then click to populate the dataset. Sometimes this results in
> > the
> > display of the database's table. However, when I try to do same thing
> > other
> > times I get a window that says: "Value cannot be null. Parameter name:
> > serviceProvider" which leads me to conclude that the dataset is empty. If
> > I
> > close that web service and relaunch it I don't get this "Value cannot be
> > null. Parameter name: serviceProvider" error!!
> >
> >
> > In either case, my client application halts on this line
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> > every time I try to consume the service and throws the exception listed
> > above.
> >
> > The operation system I use is Vista (business edition).
> >
> > When I used VS 2005 in the past I had no such errors and the web service
> > was
> > consumed without any problems. So, I am really clueless here!
> >
> >
> >
> >
> >
> > --
> > UK

>
>

 
Reply With Quote
 
Nab
Guest
Posts: n/a
 
      09-11-2008
When I invoke the service i now get this error:

System.InvalidOperationException: Fill: SelectCommand.Connection property
has not been initialized.
at System.Data.Common.DbDataAdapter.GetConnection3(Db DataAdapter adapter,
IDbCommand command, String method)
at System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)

I initialised the adapter by doing this:

Dim str As String = "SELECT EstateAgents.*.* FROM EstateAgents"

Dim estateOleAdapter As New OleDbDataAdapter(str, estateOleConnection)

But that didn't help.

I initialised the adapter:

at WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
C:\Hope\modules i teach\web services\handout
exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts
-
UK


"Patrice" wrote:

> How is estateOleAdapter initialized ?
>
> My guess is that this is Nothing so you have a null reference exception when
> you call this web method...
>
> --
> Patrice
>
> "Nab" <(E-Mail Removed)> a crit dans le message de groupe de
> discussion : (E-Mail Removed)...
> > I hope someone could shed some light on this issue. Is this relating to
> > some
> > "bug" in Visual Basic 2008 or am I doing something wrong here? I have
> > established a connection to a Microsoft Access database using the GUI
> > e.g. dragging the OleDbConnection icon on the
> > toolbox to the design area to establish the connection (i.e. not in code).
> > This process creates a connection object and an OleDbAdapter object (which
> > I
> > named estateOleAdapter as you can see in my web service's code):
> >
> > <WebMethod()> _
> > Public Function GetEstateAgents() As DataSet
> > Dim estateDataset As DataSet = New DataSet
> > estateOleAdapter.Fill(estateDataset, "EstateAgents")
> > Return estateDataset
> > estateOleConnection.Close()
> > End Function
> >
> > I also tried
> > to establish the connection and adapter in code but continue to have the
> > same
> > problem.
> >
> > Whenever I try to consume this service (using a web or even a windows
> > application this exception comes up):
> >
> > System.ServiceModel.FaultException was unhandled by user code
> > Message="System.Web.Services.Protocols.SoapExcepti on: Server was unable
> > to
> > process request. ---> System.NullReferenceException: Object reference not
> > set
> > to an instance of an object. at
> > WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
> > C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts\WebServiceLiverpoolUKEstateAgents\LiverpoolUKEs tateAgents.asmx.vb:line
> > 29 --- End of inner exception stack trace ---"
> > Source="mscorlib"
> > StackTrace:
> > Server stack trace: at
> > System.ServiceModel.Channels.ServiceChannel.Handle Reply(ProxyOperationRuntime
> > operation, ProxyRpc& rpc) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
> > TimeSpan timeout) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
> > at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvokeService(IMethodCallMessage
> > methodCall, ProxyOperationRuntime operation) at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvoke(IMessage message)
> > Exception rethrown at [0]: at
> > System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
> > reqMsg, IMessage retMsg) at
> > System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
> > msgData,
> > Int32 type) at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1Soap.GetEstateAgents()
> > at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1SoapClient.GetEstateAgents()
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Service
> > References\WebServiceLiverpoolUKEstateAgents\Refer ence.vb:line 59 at
> > ClientLiverpoolUKEstateAgents._Default.form1_Load( Object sender, EventArgs
> > e)
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Default.aspx.vb:line
> > 19 at System.Web.UI.Control.OnLoad(EventArgs e) at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint,
> > Boolean includeStagesAfterAsyncPoint)
> > InnerException:
> >
> > This is the code (inserted in a command's click procedure) that I used to
> > consume the service:
> >
> > Dim eaService As New WebServiceLiverpoolUKEstateAgents.Service1SoapClie nt
> >
> > 'Supply the dataset to become the DataGrid's datasource
> > 'dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > 'Bind the data to the datagrid by transferring
> > 'it from the dataset to the datagrid
> >
> > dgEstateAgents.DataBind()
> >
> > The dgEstateAgents is the name of the datagrid which I created using the
> > GUI. When adding a reference, I tried "Add Service Reference" and I also
> > tried "Add Web Reference", neither worked.
> >
> > To ensure that my web service is well connected to my Access database, I
> > would sometimes click on the Data icon on the menu bar and select Preview
> > Data and then click to populate the dataset. Sometimes this results in
> > the
> > display of the database's table. However, when I try to do same thing
> > other
> > times I get a window that says: "Value cannot be null. Parameter name:
> > serviceProvider" which leads me to conclude that the dataset is empty. If
> > I
> > close that web service and relaunch it I don't get this "Value cannot be
> > null. Parameter name: serviceProvider" error!!
> >
> >
> > In either case, my client application halts on this line
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> > every time I try to consume the service and throws the exception listed
> > above.
> >
> > The operation system I use is Vista (business edition).
> >
> > When I used VS 2005 in the past I had no such errors and the web service
> > was
> > consumed without any problems. So, I am really clueless here!
> >
> >
> >
> >
> >
> > --
> > UK

>
>

 
Reply With Quote
 
Nab
Guest
Posts: n/a
 
      09-11-2008
It now works but I had to code it this way:

Public Function GetEstateAgents() As DataSet
Dim str As String = "SELECT EstateAgents.* FROM EstateAgents"
Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source= C:\Hope\modules i teach\web services\handout
exercises\chapter5\LpoolEstateAgents.mdb"
Dim estateDataset As DataSet = New DataSet
Dim estateOleAdapter As New OleDbDataAdapter(str, strConnString)
estateOleAdapter.Fill(estateDataset, "EstateAgents")
Return estateDataset
estateOleConnection.Close()
End Function

The GUI way of coonecting to an Access database that worked in VB2005 does
not seem to apply to VB2008!
--
UK


"Patrice" wrote:

> How is estateOleAdapter initialized ?
>
> My guess is that this is Nothing so you have a null reference exception when
> you call this web method...
>
> --
> Patrice
>
> "Nab" <(E-Mail Removed)> a crit dans le message de groupe de
> discussion : (E-Mail Removed)...
> > I hope someone could shed some light on this issue. Is this relating to
> > some
> > "bug" in Visual Basic 2008 or am I doing something wrong here? I have
> > established a connection to a Microsoft Access database using the GUI
> > e.g. dragging the OleDbConnection icon on the
> > toolbox to the design area to establish the connection (i.e. not in code).
> > This process creates a connection object and an OleDbAdapter object (which
> > I
> > named estateOleAdapter as you can see in my web service's code):
> >
> > <WebMethod()> _
> > Public Function GetEstateAgents() As DataSet
> > Dim estateDataset As DataSet = New DataSet
> > estateOleAdapter.Fill(estateDataset, "EstateAgents")
> > Return estateDataset
> > estateOleConnection.Close()
> > End Function
> >
> > I also tried
> > to establish the connection and adapter in code but continue to have the
> > same
> > problem.
> >
> > Whenever I try to consume this service (using a web or even a windows
> > application this exception comes up):
> >
> > System.ServiceModel.FaultException was unhandled by user code
> > Message="System.Web.Services.Protocols.SoapExcepti on: Server was unable
> > to
> > process request. ---> System.NullReferenceException: Object reference not
> > set
> > to an instance of an object. at
> > WebServiceLiverpoolUKEstateAgents.Service1.GetEsta teAgents() in
> > C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\WebServiceLiverpoolUKEstateAgen ts\WebServiceLiverpoolUKEstateAgents\LiverpoolUKEs tateAgents.asmx.vb:line
> > 29 --- End of inner exception stack trace ---"
> > Source="mscorlib"
> > StackTrace:
> > Server stack trace: at
> > System.ServiceModel.Channels.ServiceChannel.Handle Reply(ProxyOperationRuntime
> > operation, ProxyRpc& rpc) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
> > TimeSpan timeout) at
> > System.ServiceModel.Channels.ServiceChannel.Call(S tring action, Boolean
> > oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
> > at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvokeService(IMethodCallMessage
> > methodCall, ProxyOperationRuntime operation) at
> > System.ServiceModel.Channels.ServiceChannelProxy.I nvoke(IMessage message)
> > Exception rethrown at [0]: at
> > System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
> > reqMsg, IMessage retMsg) at
> > System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
> > msgData,
> > Int32 type) at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1Soap.GetEstateAgents()
> > at
> > ClientLiverpoolUKEstateAgents.WebServiceLiverpoolU KEstateAgents.Service1SoapClient.GetEstateAgents()
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Service
> > References\WebServiceLiverpoolUKEstateAgents\Refer ence.vb:line 59 at
> > ClientLiverpoolUKEstateAgents._Default.form1_Load( Object sender, EventArgs
> > e)
> > in C:\Hope\modules i teach\web services\handout
> > exercises\chapter5\ClientLiverpoolUKEstateAgents\C lientLiverpoolUKEstateAgents\Default.aspx.vb:line
> > 19 at System.Web.UI.Control.OnLoad(EventArgs e) at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Control.LoadRecursive() at
> > System.Web.UI.Page.ProcessRequestMain(Boolean
> > includeStagesBeforeAsyncPoint,
> > Boolean includeStagesAfterAsyncPoint)
> > InnerException:
> >
> > This is the code (inserted in a command's click procedure) that I used to
> > consume the service:
> >
> > Dim eaService As New WebServiceLiverpoolUKEstateAgents.Service1SoapClie nt
> >
> > 'Supply the dataset to become the DataGrid's datasource
> > 'dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> >
> > 'Bind the data to the datagrid by transferring
> > 'it from the dataset to the datagrid
> >
> > dgEstateAgents.DataBind()
> >
> > The dgEstateAgents is the name of the datagrid which I created using the
> > GUI. When adding a reference, I tried "Add Service Reference" and I also
> > tried "Add Web Reference", neither worked.
> >
> > To ensure that my web service is well connected to my Access database, I
> > would sometimes click on the Data icon on the menu bar and select Preview
> > Data and then click to populate the dataset. Sometimes this results in
> > the
> > display of the database's table. However, when I try to do same thing
> > other
> > times I get a window that says: "Value cannot be null. Parameter name:
> > serviceProvider" which leads me to conclude that the dataset is empty. If
> > I
> > close that web service and relaunch it I don't get this "Value cannot be
> > null. Parameter name: serviceProvider" error!!
> >
> >
> > In either case, my client application halts on this line
> > dgEstateAgents.DataSource = eaService.GetEstateAgents
> > every time I try to consume the service and throws the exception listed
> > above.
> >
> > The operation system I use is Vista (business edition).
> >
> > When I used VS 2005 in the past I had no such errors and the web service
> > was
> > consumed without any problems. So, I am really clueless here!
> >
> >
> >
> >
> >
> > --
> > UK

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class retunring nullPointerException?? elh.maayan@gmail.com Java 4 04-21-2007 09:41 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
DataSet and dataSet JimO ASP .Net 2 03-08-2006 02:39 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM
DataSet to DataSet Joseph D. DeJohn ASP .Net 1 08-04-2003 03:25 AM



Advertisments