using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class 例4_4 : System.Web.UI.Page
{
   
    protected void Button1_Click1(object sender, EventArgs e)
    {
        string strConn = "server=(local);database=dbbook;User ID=sa;Pwd=sa1234";
        SqlConnection con = new SqlConnection(strConn);
        con.Open();
        string sql = "select count(*) from book where book_name='离散数学'";
        SqlCommand cmd = new SqlCommand(sql, con);
        Label1.Text = cmd.ExecuteScalar().ToString();
        con.Close();
    }

}
