コード例 #1
0
        /* --------------- Jokes --------------------------------------*/
        public void UpdateJokes()
        {
            SqlConnection conn   = new SqlConnection(dbconn.Configuration());
            SqlCommand    cmd    = null;
            SqlDataReader rdr    = null;
            string        sqlsel = "select * from joke";

            try
            {
                conn.Open();
                cmd = new SqlCommand(sqlsel, conn);
                rdr = cmd.ExecuteReader();

                GridViewJokes.DataSource = rdr;
                GridViewJokes.DataBind();
            }
            catch (Exception ex)
            {
                LabelMessage.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }
        }
コード例 #2
0
 public void UpdateGridviewJokes()
 {
     try
     {
         UpdateDropdown();
         UpdateDropdownCat();
         GridViewJokes.DataBind();
     }
     catch (Exception ex)
     {
         statusInfo.Text = ex.Message + ex.StackTrace;
     }
     finally
     {
         conn.Close();   // SqlDataAdapter closes connextion by itself; but can fail in case of errors
     }
 }
コード例 #3
0
 protected void DetailsViewJokes_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
 {
     GridViewJokes.DataBind();
 }