webservice代码:
public class Service1 : System.Web.Services.WebService
{
[WebMethod(Description="教师信息查询,输入教师名字,返回教师信息数组")]
public String[] Get_ByName(String name)
{
string[] NO = { "不能找到相关信息" };
// ArrayList li = new ArrayList(10);
string[] li = new string[4];
li[0] = "李春燕";
li[1] = "交通运输学院信息系";
li[2] = "13999999999";
li[3] = "cyli@bjtu.edu.cn";
string[] wang = new string[4];
// ArrayList wang = new ArrayList(10);
wang[0]="王福田";
wang[1]="交通运输学院控制欲安全系";
wang[2]="1898633333333";
wang[3]="ftwang@bjtu.edu.cn";
// ArrayList NO = new ArrayList(10);
// NO[0] = "没有找到你需要的信息";
switch(name){
case "李春燕": return li;
case "王福田": return wang;
default: return NO;
}
int i = 0;
String name2 = textBox3.Text.ToString();
String[] t = new String[4];
teacher1.Service1SoapClient w = new teacher1.Service1SoapClient("Service1Soap");
t = w.Get_ByName(name2);