• DAN疼之后上些基础知识(二)


    gridview  分页:

      protected void gvupphoto_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.gvupphoto.PageIndex = e.NewPageIndex;
            this.gvupphoto.DataBind();
        }
        protected void gvupphoto_PageIndexChanged(object sender, EventArgs e)
        {
            db.databindgv(gvupphoto, "select * from tb_userupphoto ");
        }

    提示并转到指定的页面

     Response.Write("<script language=javascript>alert('只有会员才能上传图片!!!');location='Default.aspx';</script>");

    asp.net中插入flash  在html 中添加

     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
            height="300" style=" 472px">
            <param name="movie" value="flash/f702062.swf" />
            <param name="WMODE" value="transparent">//加上这一句就透明
            <param name="quality" value="high">
            <embed height="300" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high"
                src="flash/f702062.swf" type="application/x-shockwave-flash" width="400"></embed>
        </object>

    在gridview 中用 ....代替超长字符

      SqlConnection con = new SqlConnection("Data Source=(local);database=database;uid=sa;pwd=");
            SqlDataAdapter da = new SqlDataAdapter("select * from tb_bigtitle", con);
            DataSet ds = new DataSet();
            da.Fill(ds, "table");
            GridView1.DataSource = ds;
            GridView1.DataKeyNames = new string[] { "b_id" };
            GridView1.DataBind();
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                string str ;
                DataRowView drv;
                if (GridView1.PageIndex == 0)
                {
                    drv = ds.Tables["table"].DefaultView[i];
                    str = Convert.ToString(drv["b_content"]);
                    GridView1.Rows[i].Cells[3].Text = substring(str, 5);//调用下边的方法


                }
                else
                {
                    drv = ds.Tables["table"].DefaultView[5 * (GridView1.PageIndex)];
                    str = Convert.ToString(drv["b_content"]);
                    GridView1.Rows[i].Cells[3].Text = substring(str, 5);

                }
     public string substring(string str,int n)
        {
            if (str.Length < n)
            {
                return str;
            }
            else
            {
                string newstr = str.Substring(0, n);
                newstr = newstr + "...";
                return newstr;
            }
        }

    滚动字幕

         <marquee direction="up" scrollAmount="2" scorollDelay="7" onmouseout="this.start()" onmouseover="this.stop()" >
                <span style ="font-size :14px">
                技术工艺,以上乘的质量、上佳的服务、公期,以及优越
                </span>
              </marquee>

    内嵌框架

     <iframe src ="content.aspx" name="title" width ="550" height ="280" frameborder =1 scrolling =yes style="height: 408px" ></iframe>

    框架(注意转换不到视图模式)

    <frameset rows="113,*" cols="*" frameborder="yes" border="1" framespacing="1" noresize>
          <frame src="top.aspx"  name="top" scrolling ="yes">
         
           <frameset rows="*" cols="200,*" framespacing="1" frameborder="yes" border="1">
              <frame src="left.aspx" name="left" scrolling ="yes" >
             
              <frame src="addgdgg.aspx" name="content" scrolling ="yes">
           </frameset>
          
          
     </frameset>


    启动本机发送邮件

     <a href ="mailto: chenhongjun125@163.com">chenhongjun125@163.com</a>


    局部刷新技术


    <meta http-equiv ="refresh" content ="2" />


    存储过程查数据

    SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["connectionstring"]);
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("text", con);
            da.SelectCommand.CommandType  = CommandType.StoredProcedure;
            DataSet ds = new DataSet();
            da.Fill(ds);
            gvtext.DataSource = ds;
            gvtext.DataKeyNames = new string[] { "id" };
            gvtext.DataBind();


    用存储过程存数据

    SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["connectionstring"]);
            con.Open();
            try
            {
                SqlCommand com = new SqlCommand("addtext", con);
                com.CommandType = CommandType.StoredProcedure;
                SqlParameter[] prams ={
                new SqlParameter ("title",SqlDbType .VarChar ,50),
                new SqlParameter ("content",SqlDbType .VarChar ,50),
            };
                prams[0].Value = tbtitle.Text;
                prams[1].Value = tbcontent.Text;
                foreach (SqlParameter parameter in prams)
                {
                    com.Parameters.Add(parameter);
                }
                com.ExecuteNonQuery();
                con.Close();
            }
            finally
            {
     
            }

  • 相关阅读:
    Java在控制台运行IDE工具编写的程序
    mysql数据库执行存储过程问题
    Java之正则表达式在字符串中查找中文
    java之endwith()方法以及正则表达式匹配中文
    工具资源 Java并发编程:CountDownLatch、CyclicBarrier和 Semaphore
    5、概率图模型 Inference-Variable_Elimination
    4、概率图模型:Template Modles
    3、概率图模型:Local Structure in Markov Network
    2、概率图模型: Markov Random Fields
    1、概率图模型: Bayesian Networks
  • 原文地址:https://www.cnblogs.com/zhanlang/p/2021880.html
Copyright © 2020-2023  润新知