wsreademployees.cs

来自「《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含」· CS 代码 · 共 38 行

CS
38
字号
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Configuration;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// wsReadEmployees 的摘要描述
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class wsReadEmployees : System.Web.Services.WebService
{

	public wsReadEmployees()
	{

		//如果使用设计的组件,请取消注释下行程序代码 
		//InitializeComponent(); 
	}

	[WebMethod]
	public DataSet ReadEmployees()
	{
		//读取员工基本信息的Web Services
		string connString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString1"].ConnectionString;
		string strCmd = "Select EmployeeID,LastName,City,Country from Employees";
		SqlDataSource sqlds = new SqlDataSource(connString, strCmd);
		DataView dvEmployees=(DataView)sqlds.Select(DataSourceSelectArguments.Empty);
		return dvEmployees.Table.DataSet;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?