大家好,下面是我想使用的 WebService 类(我写的)。问题是我不太确定如何使用它。我有一个 WinForm 通过另一个实例连接到数据库DataAccessObject
。
用户必须能够单击一个按钮,该按钮将打开表单的网站版本并从那里修改数据库。
问题是我不知道如何使用服务来做到这一点
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Xml.Linq;
using System.Configuration;
/// <summary>
/// Summary description for DataManager
/// </summary>
[WebService(Namespace = "/201103578Site//Default.aspx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
//[System.Web.Script.Services.ScriptService]
public class DataManager : System.Web.Services.WebService
{
XElement[] xmlCompany = null;
XElement[] xmlCandidate = null;
XElement[] xmlQualification = null;
public DataManager ()
{
//Uncomment the following line if using designed components
//InitializeComponent();
DataAccessObject.DataAccessObject daoDataBase = new DataAccessObject.DataAccessObject(ConfigurationManager.ConnectionStrings[1].ToString());
daoDataBase.openConnection();
xmlCompany = daoDataBase.sqlSelectCompany(new SQL.SqlImplementation(), "Select * From Company");
xmlCandidate = daoDataBase.sqlSelectCandidate(new SQL.SqlImplementation(), "Select * From Candidate");
xmlQualification = daoDataBase.sqlSelectQualification(new SQL.SqlImplementation(), "Select * From Qualification");
daoDataBase.closeConnection();
}
[WebMethod]
public XElement[] getXmlCompany()
{
return xmlCompany;
}
[WebMethod]
public XElement[] getXmlCandidate()
{
return xmlCandidate;
}
[WebMethod]
public XElement[] getXmlQualification()
{
return xmlQualification;
}
}
我想调用getXmlCompany
Company.aspx.cs 文件中的任何其他方法,就像调用任何其他方法一样——如果可能的话
亲切的问候
马库斯