dataservice.asmx
来自「asp做的新闻系统」· ASMX 代码 · 共 30 行
ASMX
30 行
<%@ WebService Language="C#" Class="DataService" %>
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
public class DataService {
[WebMethod]
public DataSet GetTitleAuthors() {
SqlConnection myConnection = new
SqlConnection("server=localhost;database=pubs;Trusted_Connection=yes");
SqlDataAdapter myCommand1 = new SqlDataAdapter ("select * from Authors", myConnection);
SqlDataAdapter myCommand2 = new SqlDataAdapter("select * from Titles", myConnection);
DataSet ds = new DataSet();
myCommand1.Fill(ds, "Authors");
myCommand2.Fill(ds, "Titles");
return ds;
}
[WebMethod]
public int PutTitleAuthors(DataSet ds) {
return ds.Tables[0].Rows.Count;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?