C++.NET coding in window form client for interacting with WEb Serv

G

Guest

I have written the Web Services in VBaic .Net. One function interface:
DataSet GetAllPatients()
which will be called in remote client and return DataSet.
I have written the clients by using both C# and VB, and they work fine. Due
to some reason, I have to use C++ in .NET IDE. Now I confuss with the use of
pointer.
I have trouble in coding and compiling. The following is my simple code,
anyone could be kind of helping me to figure out the problem. Thank you very
much.
In Form1.h file I have the code

private: System::Data::DataSet * dsAllPatients;
private: System::Windows::Forms::DataGrid * dgPatients;
private: WebRefFTPLocation::FTPLocationWebService * ProxyGetAllPatients;

private: System::Void Form1_Load(System::Object * sender, System::EventArgs
* e)
{


dsAllPatients->Clear();
dsAllPatients = new DataSet("Patients");
dsAllPatients=ProxyGetAllPatients.GetPatients();
dgPatients->DataSource = dsAllPatients;
dgPatients->DataBindings;

}


EORROR message:
d:\..\WebServicesClientFTP\simpleFormClient\Form1.h(241): error C2228: left
of '.GetPatients' must have class/struct/union type


David
 
G

Guest

I found one bug at: dsAllPatients=ProxyGetAllPatients.GetPatients();
It should be: dsAllPatients=ProxyGetAllPatients->GetPatients();

But I still get runtime error when run it:
"An unhandled exception of type 'System.NullReferenceException' occurred in
system.web.services.dll

Additional information: Object reference not set to an instance of an object.
"
What wrong with it. Thanks.

David
 
B

Bruce Barker

most likely ProxyGetAllPatients is null or dsAllPatients is null (never
init'd). also not sure of the following code:

dsAllPatients->Clear(); // why clear if
reassign in next statement
// and
who inits it?
dsAllPatients = new DataSet("Patients"); // why if next statment
dsAllPatients=ProxyGetAllPatients->GetPatients();


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top