asp.net数据库操作4——scalar

    技术2022-05-11  166

    if(!Page.IsPostBack)   {    SqlConnection conn = new SqlConnection(con);    conn.Open();

        string strSql = "select count(id) as countID from 公告";    SqlCommand cm = new SqlCommand(strSql,conn);

        string intCount = cm.ExecuteScalar().ToString();    conn.Close();

        Label1.Text = intCount;   }


    最新回复(0)