The resources of handheld devices are limited. Therefore, in applications, you often need to use WEB services to implement relevant business functions. The functions are displayed only on the terminal. Two projects need to be developed: a PDA program, a web service Program, and the webservice program to implement related business functions. The interface is drawn on the PDA program to display the processing results.
Add a web reference to the PDA program. The reference is as follows:
The code for the corresponding call is as follows:
[Csharp]
WebReference. SulfService ws = new DeviceApplication1.WebReference. SuService ();
Try
{
Using (DataSet ds = ws. GetSuInfo ())
{
Int length = ds. Tables [0]. Rows. Count;
DataGrid1.DataSource = ds. Tables [0];
DataGrid1.Refresh ();
}
}
Catch (Exception ex)
{
MessageBox. Show ("the network is disconnected. Please check! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Exclamation, MessageBoxDefaultButton. Button1 );
}
WebReference. SulfService ws = new DeviceApplication1.WebReference. SuService ();
Try
{
Using (DataSet ds = ws. GetSuInfo ())
{
Int length = ds. Tables [0]. Rows. Count;
DataGrid1.DataSource = ds. Tables [0];
DataGrid1.Refresh ();
}
}
Catch (Exception ex)
{
MessageBox. Show ("the network is disconnected. Please check! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Exclamation, MessageBoxDefaultButton. Button1 );
}
The following code is displayed on the gun after the call:
From # Define