⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bk7.cs

📁 编写web服务,并在客户端进行调用,包括控制台应用程序,web应用程序
💻 CS
字号:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
using System.Data;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{

    private SqlCommand sqlSelectCommand1;
    private SqlConnection sqlConnection1;
    private DataSet getyydataset1;
    private SqlDataAdapter sqlDataAdapter1;
    public Service () {

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

    [WebMethod(Description = "使用sql语句")]
    public DataSet Getyy()
    {
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = "server=(local);Initial Catalog=bk;Integrated Security=True";
        conn.Open();
        SqlCommand com = new SqlCommand("select * from bk1", conn);
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = com;
        DataSet ds = new DataSet();
        da.Fill(ds);
        conn.Close();
        return ds;



    }

    [WebMethod(Description = "使用存储过程")]
    public DataSet get()
    {
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = "server=(local);Initial Catalog=bk;Integrated Security=True";
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = new SqlCommand();
        da.SelectCommand.Connection = conn;
        da.SelectCommand.CommandText = "uu";
        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        DataSet st = new DataSet();
        da.Fill(st, "uu");
        conn.Close();
        return st;
    }
    
}

⌨️ 快捷键说明

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