Question Window form & web service

damxuanthai

Well-known member
Joined
Mar 1, 2007
Messages
48
Location
Việt Nam.
Programming Experience
Beginner
Hi all Prof.

Today I have a problem on Web service that I can not find the way to get out.

The Problem is

I made a webservice and put it on my host
"http://damxuanthai.edu.vn/damxuanthai01.asmx"

In which, I have a webmethod to select and return a datashet from one database mdb file.

VB.NET:
<WebMethod()> _
    Public Function SelectDataShet() As DataSet
        Dim strConnectionToDatabase As String = "Provider=Microsoft.Jet.Oledb.4.0; Data Source =" & strPublicMDBpath
        Dim cls As New clsDoDatabase(strConnectionToDatabase)
        Dim dtsOut As New DataSet
        cls.FillData_ToDataShet(dtsOut, strQuiry)
        Return dtsOut
    End Function

This web function can work online well when be called by any .aspx files in my site

Now I make make a Window form contain 1 datagridview and 1 button, I try to get my datashet:

VB.NET:
        Dim Mb As New Online.damxuanthai01
        Dim dtbList As New DataSet        
        dtbList = Mb.SelectDataShet
        DataGridView1.DataSource = dtbList.Tables(0)

But It make an Error

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at damxuanthai01.SelectDataShet() --- End of inner exception stack trace ---

I don't know to solve this Error.

I am hopefully waitting for some solutions.
 
First off the SelectDataShet Method needs two parameters.

But check your webservice. The method clsDoDatabase is prob. killing your DS
 
First off the SelectDataShet Method needs two parameters.

But check your webservice. The method clsDoDatabase is prob. killing your DS

Thank rcombs4

Actually, clsDodatabase is a class which use to access to database. It cause no error while running inside an ASP page application that perform in the same host (http://...) with this web service. The coding cause this Error in Window form application only.

Anyway, thank alot for reply.

I would like to see another ideas. :confused:
 
Back
Top