Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string        connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
        SqlConnection conn    = new SqlConnection(connStr);

        conn.Open();

        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.Connection  = conn;
            cmd.CommandText = "SELECT dateandtime,message FROM publics WHERE projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC";

            SqlDataReader dr = cmd.ExecuteReader();

            codemaker maker = new codemaker();

            while (dr.Read())
            {
                result = result + maker.records(dr[0].ToString().Trim(), dr[1].ToString().Trim());
            }
        }
        catch
        {
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }