protected void btnXpathUpdae_Click(object sender, EventArgs e)
 {
     try
     {
         CnDataAcess.Entity.CnInterfaceVideoXpath cnXpath = new CnDataAcess.Entity.CnInterfaceVideoXpath();
         cnXpath.CnWebName = Request["web"].ToString().Trim();
         cnXpath.CnWebUrl = txtWebAddress.Text.Trim();
         cnXpath.CnWebEncode = txtWebEncode.Text.Trim();
         cnXpath.CnVideoTitle001 = txtTitle001.Text.Trim();
         cnXpath.CnVideoHref001 = txtHref001.Text.Trim();
         cnXpath.CnVideoSrc001 = txtSrc001.Text.Trim();
         cnXpath.CnVideoTitle002 = txtTitle002.Text.Trim();
         cnXpath.CnVideoHref002 = txtHref002.Text.Trim();
         cnXpath.CnVideoSrc002 = txtSrc002.Text.Trim();
         cnXpath.CnVideoTitle003 = txtTitle003.Text.Trim();
         cnXpath.CnVideoHref003 = txtHref003.Text.Trim();
         cnXpath.CnVideoSrc003 = txtSrc003.Text.Trim();
         cnXpath.CnVideoTitle004 = txtTitle004.Text.Trim();
         cnXpath.CnVideoHref004 = txtHref004.Text.Trim();
         cnXpath.CnVideoSrc004 = txtSrc004.Text.Trim();
         cnXpath.CnVideoTitle005 = txtTitle005.Text.Trim();
         cnXpath.CnVideoHref005 = txtHref005.Text.Trim();
         cnXpath.CnVideoSrc005 = txtSrc005.Text.Trim();
         cnXpath.CnVideoTitle006 = txtTitle006.Text.Trim();
         cnXpath.CnVideoHref006 = txtHref006.Text.Trim();
         cnXpath.CnVideoSrc006 = txtSrc006.Text.Trim();
         int resultCount = 0;
         resultCount = CnBusinessLogic.CnInterfaceVideoXpath.UpdateCnInterfaceVideo(cnXpath);
         if (resultCount > 0)
         {
             Response.Redirect("ParseXPathManage.aspx?update=ok&web="+Request["web"].ToString().Trim());
         }
         else
         {
             labUpdateResult.Text = "<font color='red'><b>数据库更新失败!</b></font>";
         }
     }
     catch (Exception ex)
     {
         labUpdateResult.Text = "<font color='red'><b>数据库更新失败!</b></font><font color='#666699'>" + ex.Message + "</font>";
     }
 }
 public CnDataAcess.Entity.CnInterfaceVideoXpath GetVideoXpathByWebName(string webname)
 {
     string sql = @"SELECT * FROM [Cn_InterfaceVideoXpath] WHERE [CnWebName] = @CnWebName";
     CnDataAcess.Entity.CnInterfaceVideoXpath cnXpath = null;
     string conStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionStr"].ToString();
     using (SqlConnection conn = new SqlConnection(conStr))
     {
         conn.Open();
         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandType = CommandType.Text;
         cmd.CommandText = sql;
         cmd.Parameters.AddWithValue("@CnWebName", webname);
         SqlDataReader sdr = cmd.ExecuteReader();
         if (sdr.Read())
         {
             cnXpath = new CnDataAcess.Entity.CnInterfaceVideoXpath();
             cnXpath.CnWebName = sdr["CnWebName"] as string;
             cnXpath.CnWebUrl = sdr["CnWebUrl"] as string;
             cnXpath.CnWebEncode = sdr["CnWebEncode"] as string;
             cnXpath.CnVideoTitle001 = sdr["CnVideoTitle001"] as string;
             cnXpath.CnVideoHref001 = sdr["CnVideoHref001"] as string;
             cnXpath.CnVideoSrc001 = sdr["CnVideoSrc001"] as string;
             cnXpath.CnVideoTitle002 = sdr["CnVideoTitle002"] as string;
             cnXpath.CnVideoHref002 = sdr["CnVideoHref002"] as string;
             cnXpath.CnVideoSrc002 = sdr["CnVideoSrc002"] as string;
             cnXpath.CnVideoTitle003 = sdr["CnVideoTitle003"] as string;
             cnXpath.CnVideoHref003 = sdr["CnVideoHref003"] as string;
             cnXpath.CnVideoSrc003 = sdr["CnVideoSrc003"] as string;
             cnXpath.CnVideoTitle004 = sdr["CnVideoTitle004"] as string;
             cnXpath.CnVideoHref004 = sdr["CnVideoHref004"] as string;
             cnXpath.CnVideoSrc004 = sdr["CnVideoSrc004"] as string;
             cnXpath.CnVideoTitle005 = sdr["CnVideoTitle005"] as string;
             cnXpath.CnVideoHref005 = sdr["CnVideoHref005"] as string;
             cnXpath.CnVideoSrc005 = sdr["CnVideoSrc005"] as string;
             cnXpath.CnVideoTitle006 = sdr["CnVideoTitle006"] as string;
             cnXpath.CnVideoHref006 = sdr["CnVideoHref006"] as string;
             cnXpath.CnVideoSrc006 = sdr["CnVideoSrc006"] as string;
         }
     }
     return cnXpath;
 }