1. 程式人生 > >Repeater增刪改查(內嵌checkbox)版本

Repeater增刪改查(內嵌checkbox)版本

基礎知識比較重要為了鞏固以前所學習的,在此篇部落格中主要描述了下以前repeater中常用的一些增刪改查,更主要的是為了利用Jquery完成全選批量刪除的功能,程式碼十分簡單也沒使用儲存過程,歡迎提出您的見解和意見謝謝~此文只為分享學習~

前臺Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RepeaterDemo._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Repeater增刪改查例項(內嵌Checkbox版)</title>
    <style type="text/css">
        tr td span
        {
            font-family: @宋體, Arial;
            font-size: small;
            color: Gray;
        }
        tr td
        {
            width: 100px;
            text-align: center;
        }
    </style>
    <%--<script src="Jquery/jquery-1.4.min.js" type="text/javascript" language="javascript"></script>--%>

    <script src="Jquery/jquery-1.4.2-vsdoc.js" type="text/javascript" language="javascript"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            $("tr[id='repeaterTr']").each(function() {
                $(this).mouseover(function() {
                    $(this).css("background-color", "#77DDFF");
                })
                $(this).mouseout(function() {
                    $(this).css("background-color", "#FFFFFF");
                });
            });
            //toggle用於切換2個函式
            $("#btnCheckAll").toggle(function() {
                if ($("#btnCheckAll").html() == "全選") {
                    $("#btnCheckAll").click(function() {
                        $(this).html("反選");
                        $("input[name='product']").each(function() {
                            if ($(this).attr("checked", false)) {
                                $(this).attr("checked", true);
                            }
                        })
                    })
                }
            }, function() {
                if ($("#btnCheckAll").html() == "反選") {
                    $("#btnCheckAll").click(function() {
                        $(this).html("全選");
                        $("input[name='product']").each(function() {
                            if ($(this).attr("checked", true)) {
                                $(this).attr("checked", false);
                            }
                        })
                    })
                }
            })
        })

        function TransformIDs() {
            var checkedArray = new Array();
            $("input[name='product']").each(function() {
                if ($(this).attr("checked") == true) {
                    checkedArray.push($(this).val());
                }
            })
            $("#checkedIds").get(0).value = checkedArray.join(';');
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div align="center">
            repeater例項</div>
        <input type="hidden" runat="server" id="checkedIds" />
        <table border="1" style="width: 600px; border-style: solid; border-collapse: collapse"
            align="center">
            <tr>
                <td>
                    <button id="btnCheckAll" type="button" value="checkAll" style="border-style: solid">
                        全選</button>
                </td>
                <td>
                    <span>序號</span>
                </td>
                <td>
                    <span>商品名</span>
                </td>
                <td>
                    <span>單價</span>
                </td>
                <td>
                    <span>簡介</span>
                </td>
                <td>
                    <span>訂購日期</span>
                </td>
                <td>
                    <span>操作</span>
                </td>
            </tr>
            <asp:Repeater ID="rpProduct" runat="server" OnItemCommand="rpProduct_ItemCommand">
                <ItemTemplate>
                    <tr id="repeaterTr">
                        <td>
                            <input type="checkbox" id="chkDelete" name="product" value='<%#Eval("ProductID") %>' />
                        </td>
                        <td>
                            <%#Container.ItemIndex + 1%>
                        </td>
                        <td>
                            <%#Eval("ProductName")%>
                        </td>
                        <td>
                            <%#Eval("UnitPrice", "{0:C}")%>
                        </td>
                        <td>
                            <%#Eval("Description")%>
                        </td>
                        <td>
                            <%#Eval("CreateTime")%>
                        </td>
                        <td>
                            <asp:LinkButton ID="lkbtnEdit" runat="server" Text="編輯" ToolTip="編輯" CommandName="Edit"
                                CommandArgument='<%#Eval("ProductID") %>' Font-Size="Small"></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
        <table border="1" style="width: 600px; border-style: solid; border-collapse: collapse"
            align="center">
            <tr>
                <td align="center">
                    <span>商品名</span>
                </td>
                <td align="center">
                    <span>單價</span>
                </td>
                <td align="center">
                    <span>簡介</span>
                </td>
            </tr>
            <tr>
                <td style="width: 200px" align="center">
                    <asp:TextBox ID="txtProductName" runat="server" Width="200px"></asp:TextBox>
                </td>
                <td style="width: 200px" align="center">
                    <asp:TextBox ID="txtUnitPrice" runat="server" Width="200px"></asp:TextBox>
                </td>
                <td style="width: 200px" align="center">
                    <asp:TextBox ID="txtDescription" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="3" align="center">
                    <asp:Button ID="btnAdd" runat="server" Text="新增" OnClick="btnAdd_Click" BorderStyle="Solid" />
                    <asp:Button ID="btnDelete" runat="server" Text="刪除" OnClick="btnDelete_Click" BorderStyle="Solid"
                        OnClientClick="TransformIDs()" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

後臺Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Text.RegularExpressions;

namespace RepeaterDemo
{
    /// <summary>
    /// 簡化例子沒有分層與使用儲存過程
    /// </summary>
    public partial class _Default : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RepeatDataBind();
            }
        }
        /// <summary>
        /// repeater控制元件資料繫結
        /// </summary>
        private void RepeatDataBind()
        {
            rpProduct.DataSource = GetProduct().Tables["Product"];
            rpProduct.DataBind();
        }
        /// <summary>
        /// 新增新商品記錄
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            bool flag = InsertNewProduct();
            if (flag)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新增成功!')</script>");
                RepeatDataBind();
                ClearData(this.Page.Controls);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新增失敗發生異常!')</script>");
                return;
            }
        }
        /// <summary>
        /// 返回結果
        /// </summary>
        /// <returns></returns>
        private DataSet GetProduct()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Product", conn);
            DataSet ds = new DataSet();
            da.Fill(ds, "Product");
            return ds;
        }
        /// <summary>
        /// 插入新記錄
        /// </summary>
        /// <returns></returns>
        private bool InsertNewProduct()
        {
            bool flag = false;
            Regex regx = new Regex(@"^/d+$");
            if (!regx.IsMatch(txtUnitPrice.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您輸入的不是數字請重新輸入!')</script>");
                return false;
            }
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand(@"INSERT INTO Product (ProductName, UnitPrice, Description, CreateTime) VALUES (@ProductName, @UnitPrice, @Description, @CreateTime)", conn);
            cmd.Parameters.Add("@ProductName", SqlDbType.NVarChar, 1000).Value = txtProductName.Text.Trim();
            cmd.Parameters.Add("@UnitPrice", SqlDbType.Decimal, int.MaxValue).Value = Convert.ToDecimal(txtUnitPrice.Text.Trim());
            cmd.Parameters.Add("@Description", SqlDbType.Text, int.MaxValue).Value = txtDescription.Text.Trim();
            cmd.Parameters.Add("@CreateTime", SqlDbType.DateTime, int.MaxValue).Value = DateTime.Now;
            try
            {
                conn.Open();
                int result = cmd.ExecuteNonQuery();
                flag = result == 0 ? false : true;
            }
            catch (Exception)
            {

            }
            finally
            {
                conn.Close();
            }
            return flag;
        }
        /// <summary>
        /// 刪除記錄
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        private bool DeleteProduct(int productID)
        {
            bool flag = false;
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand(@"DELETE FROM Product WHERE ProductID = @ProductID", conn);
            cmd.Parameters.Add("@ProductID", SqlDbType.Int, int.MaxValue).Value = productID;
            try
            {
                conn.Open();
                int result = cmd.ExecuteNonQuery();
                flag = result == 0 ? false : true;
            }
            catch (Exception)
            {

            }
            finally
            {
                conn.Close();
            }
            return flag;
        }

        /// <summary>
        /// 批量刪除可以用 DELETE FROM TestTable WHERE ID IN (1, 3, 54, 68)  --sql2005下執行通過
        /// 批量插入可以用
        /// sql寫法:    INSERT INTO TestTable SELECT 1, 'abc' UNION SELECT  2, 'bcd'  UNION SELECT 3, 'cde'       --TestTable表沒有主鍵,ID不是主鍵   
        /// oracle寫法:    INSERT INTO TestTable SELECT 1, 'abc' From daul UNION SELECT  2, 'bcd' From daul        --TestTable表沒有主鍵,ID不是主鍵
        /// </summary>
        /// <param name="productIDs"></param>
        /// <returns></returns>
        private bool DeleteProduct(string[] productIDs)
        {
            bool flag = false;
            string delSqlIds = string.Empty;
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            for (int i = 0; i < productIDs.Length; i++)
            {
                delSqlIds += productIDs[i] + ", ";
            }
            delSqlIds = delSqlIds.Substring(0, delSqlIds.LastIndexOf(","));
            SqlCommand cmd = new SqlCommand(@"DELETE FROM Product WHERE ProductID in (" + delSqlIds + ")", conn);
            try
            {
                conn.Open();
                int result = cmd.ExecuteNonQuery();
                flag = result == 0 ? false : true;
            }
            catch (Exception)
            {

            }
            finally
            {
                conn.Close();
            }
            return flag;
        }

        protected void rpProduct_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string commandName = e.CommandName;
            int productID = Convert.ToInt32(e.CommandArgument);
            if (commandName == "Edit")
            {
                Response.Redirect("EditProduct.aspx?Id=" + productID);
            }
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string[] ids = checkedIds.Value.Split(';');
            bool flag = DeleteProduct(ids);
            if (flag)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('刪除成功!')</script>");
                RepeatDataBind();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('刪除失敗發生異常!')</script>");
                return;
            }
        }

    }
}

前臺 EditProduct.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditProduct.aspx.cs" Inherits="RepeaterDemo.EditProduct" %>

<%@ Register Src="EditProductCtrl.ascx" TagName="EditProductCtrl" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <table border="1" style="width: 600px; border-style: solid; border-collapse: collapse"
        align="center">
        <tr>
            <td align="center">
                <uc1:EditProductCtrl ID="EditProductCtrl1" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <asp:Button ID="btnEdit" runat="server" Text="編輯" OnClick="btnEdit_Click" BorderStyle="Solid" />
                <asp:Button ID="btnReturn" runat="server" Text="返回" OnClick="btnReturn_Click" BorderStyle="Solid" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

後臺 EditProduct.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Model;
using System.Text.RegularExpressions;

namespace RepeaterDemo
{
    public partial class EditProduct : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int productID = int.Parse(Request.QueryString["Id"]);
                PageInit(productID);
                ViewState["ProductID"] = productID;
            }
        }

        protected void btnEdit_Click(object sender, EventArgs e)
        {
            int productID = Convert.ToInt32(ViewState["ProductID"]);
            bool flag = EditCurrentProduct(productID);
            if (flag)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新成功!');document.location.href='Default.aspx'</script>");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失敗發生異常!');document.location.href='Default.aspx'</script>");
                return;
            }
        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
        }

        private void PageInit(int productID)
        {
            Product currentProduct = GetCurrentProduct(productID);
            this.EditProductCtrl1.ProductName = currentProduct.ProductName;
            this.EditProductCtrl1.UnitPrice = currentProduct.UnitPrice;
            this.EditProductCtrl1.Description = currentProduct.Decription;
        }
        /// <summary>
        /// 取得當前修改物件
        /// </summary>
        /// <returns></returns>
        private Product GetCurrentProduct(int productID)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Product WHERE ProductID = @ProductID", conn);
            da.SelectCommand.Parameters.Add("@ProductID", SqlDbType.Int, int.MaxValue).Value = productID;
            DataSet ds = new DataSet();
            da.Fill(ds, "Product");
            Product currentProduct = new Product();
            currentProduct.ProductID = ds.Tables["Product"].Rows[0]["ProductID"] == null ? 0 : Convert.ToInt32(ds.Tables["Product"].Rows[0]["ProductID"]);
            currentProduct.ProductName = ds.Tables["Product"].Rows[0]["ProductName"] == null ? string.Empty : (ds.Tables["Product"].Rows[0]["ProductName"]).ToString();
            currentProduct.UnitPrice = ds.Tables["Product"].Rows[0]["UnitPrice"] == null ? 0 : Convert.ToDecimal(ds.Tables["Product"].Rows[0]["UnitPrice"]);
            currentProduct.Decription = ds.Tables["Product"].Rows[0]["Description"] == null ? string.Empty : (ds.Tables["Product"].Rows[0]["Description"]).ToString();
            currentProduct.CreateTime = ds.Tables["Product"].Rows[0]["CreateTime"] == null ? DateTime.Now : Convert.ToDateTime(ds.Tables["Product"].Rows[0]["CreateTime"]);
            return currentProduct;
        }
        /// <summary>
        /// 更新當前物件
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        private bool EditCurrentProduct(int productID)
        {
            bool flag = false;
            if (this.EditProductCtrl1.UnitPrice == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('您輸入的不是數字請重新輸入,格式不正確!')</script>");
                return false;
            }
            string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand(@"UPDATE Product SET ProductName = @ProductName, UnitPrice = @UnitPrice, Description = @Description WHERE ProductID = @ProductID", conn);
            cmd.Parameters.Add("@ProductName", SqlDbType.NVarChar, 1000).Value = this.EditProductCtrl1.ProductName;
            cmd.Parameters.Add("@UnitPrice", SqlDbType.Decimal, int.MaxValue).Value = this.EditProductCtrl1.UnitPrice;
            cmd.Parameters.Add("@Description", SqlDbType.Text, int.MaxValue).Value = this.EditProductCtrl1.Description;
            cmd.Parameters.Add("@ProductID", SqlDbType.Int, int.MaxValue).Value = productID;
            try
            {
                conn.Open();
                int result = cmd.ExecuteNonQuery();
                flag = result == 0 ? false : true;
            }
            catch (Exception)
            {

            }
            finally
            {
                conn.Close();
            }
            return flag;
        }
    }
}

使用者控制元件前臺 EditProductCtrl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditProductCtrl.ascx.cs"
    Inherits="RepeaterDemo.EditProductCtrl" %>
<table border="1" style="width: 600px; border-style: solid; border-collapse: collapse"
    align="center">
    <tr>
        <td align="center">
            <span>商品名</span>
        </td>
        <td align="center">
            <span>單價</span>
        </td>
        <td align="center">
            <span>商品描述</span>
        </td>
    </tr>
    <tr>
        <td style="width: 200px" align="center">
            <asp:TextBox ID="txtProductName" runat="server" Width="200px"></asp:TextBox>
        </td>
        <td style="width: 200px" align="center">
            <asp:TextBox ID="txtUnitPrice" runat="server" Width="200px"></asp:TextBox>
        </td>
        <td style="width: 200px" align="center">
            <asp:TextBox ID="txtDescription" runat="server" Width="200px"></asp:TextBox>
        </td>
    </tr>
    </table>

使用者控制元件後臺 EditProductCtrl.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;

namespace RepeaterDemo
{
    public partial class EditProductCtrl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 商品名
        /// </summary>
        public string ProductName
        {
            get { return txtProductName.Text; }
            set { txtProductName.Text = value; }
        }
        /// <summary>
        /// 商品單價
        /// </summary>
        public decimal UnitPrice
        {
            get
            {
                Regex regx = new Regex(@"^/d+$");
                string unitPrice = txtUnitPrice.Text.Trim();
                if (unitPrice.Contains("."))
                {
                    unitPrice = unitPrice.Substring(0, unitPrice.IndexOf("."));
                    return regx.IsMatch(unitPrice) ? Convert.ToDecimal(unitPrice) : 0;
                }
                else
                {
                    return regx.IsMatch(unitPrice) ? Convert.ToDecimal(unitPrice) : 0;
                }
            }
            set { txtUnitPrice.Text = value.ToString(); }
        }
        /// <summary>
        /// 商品描述
        /// </summary>
        public string Description
        {
            get { return txtDescription.Text; }
            set { txtDescription.Text = value; }
        }
    }
}

相關推薦

Repeater刪改(checkbox)版本

基礎知識比較重要為了鞏固以前所學習的,在此篇部落格中主要描述了下以前repeater中常用的一些增刪改查,更主要的是為了利用Jquery完成全選批量刪除的功能,程式碼十分簡單也沒使用儲存過程,歡迎提出您的見解和意見謝謝~此文只為分享學習~ 前臺Default.aspx &l

字典的刪改

body pre 嵌套 一行代碼 .get dbo clear 增刪改查 value 字典:python中非常重要的數據類型,在python中唯一一個映射的數據類型數據類型分類 按照數據可變與不可變: # 不可變數據類型: int str bool tuple # 可變數據

第五天 字典的介紹,dict刪改套 及for循環

.get set 增加 判斷 eight 保存 back 存在 組成 字典(dict)是python中唯一的一個映射類型.他是以{ }括起來的鍵值對組成. 在dict中key是唯一的. dict 用大括號 {} 括起來,內部使用key:value 的形式保存數據

Python - 字典--刪改/建方法大全

字典 是另一種可變容器模型,且可儲存任意型別物件。 字典的每個鍵值 key=>value 對用冒號 : 分割,每個鍵值對之間用逗號 , 分割,整個字典包括在花括號 {} 中; 鍵一般是唯一的,如果重複最後的一個鍵值對會替換前面的,值不需要唯一; 值可以取

MongoDB的java操作刪改總結篇(文件、陣列)

Mongo資料User: "_id" : "11373126679","name" : "Wangwei","his_Record" : [{"bikeId" : "309","status" : 1}],"location" : {"Area" : "aaa","X" :

mongodb對陣列元素及文件進行刪改操作

https://my.oschina.net/132722/blog/168274 比如我有一個user類,他包含一個標籤屬性,這個標籤是一個數組,數組裡面的元素是內嵌文件,格式如下: <!-- lang: js --> { "_id" : "195861", "tags" :

3.mongodb 對於文件的刪改

假如說我們這個集合裡面的文件都是這種格式: { "_id" : ObjectId("5c177b84f4e84940e0bd578d"), "name" : "suhaozhi", "pwd" : "suhaozhi", "phone" : [ { "phone_num" : "1333

函數、文件操作實現數據刪改---low版本

腳本 python 首先說明這個腳本很low,目前水平有限,只能實現使用固定的語法對數據進行增刪改查。但是現在腳本不low,怎麽讓明年的我來嘲笑今年的自己需求 a.可進行模糊查詢,語法至少支持下面3種:    select name,age from staff_table where

04_web基礎(八)之車票實現刪改初級版本

lose src uri sed RR 實現 手動添加 jsp頁面 ebs 43.web頁面顯示車票列表簡略完成   代碼:   控制層代碼 1 package com.day03.station.controller; 2 3 import com.day03

列表(索引與切片,刪改) ,計數,排序,元祖和元祖的

元素 col 切片 ack list 升序 不能 height pen 1.列表 1.列表相比於字符串. 不限制數據類型. 而且可以存放大量的數據   2.表示方式: [] 方括號中的每一項都要逗號隔開   3.列表和字符串一樣,也有索引與切片 常用功

mysql5.7版本刪改

一個 查看數據庫 我們 沒有 info 新建 分享圖片 使用 創建 查看數據庫 新建數據庫 使用school數據庫因為這個數據庫剛剛創建裏面沒有表所以看不到表,下面我們要創建表,並對表進行增刪改查 創建名為info的表,首先需要定義表的結構。我們可以使用desc 表名來查看

IOS資料處理及版本特性-CoreData的刪改

// //  ViewController.swift //  Dome2test // //  Created by 郭文亮 on 2018/11/21. //  Copyright © 2018年 finalliang. All rights rese

(一)solr 7.31版本window系統全程安裝搭建,涵蓋專案用到的大部分配置,常用查詢,solr多條件查詢、排序,配置資料庫,定時同步,全量與增量更新,使用solrJ在java程式進行刪改

前言:由於專案最近在做淘寶客商品資訊查詢這一塊,做搜尋引擎,離不開全文搜尋伺服器,我這裡選擇了solr。solr的好處可以自行百科,這裡主要是講解技術。這篇文章主要講解window的安裝和使用。若大家感興趣或者專案用到,希望你能跟著我的步驟進行下去,如果遇到問題,可以後續看下我在最底下的問題

MySQL:記錄的刪改、單表查詢、約束條件、多表查詢、連表、子查詢、pymysql模組、MySQL建功能

資料操作 插入資料(記錄): 用insert; 補充:插入查詢結果: insert into 表名(欄位1,欄位2,...欄位n) select (欄位1,欄位2,...欄位n) where ...; 更新資料update 語法: update 表名 set 欄位1=

Mongodb 對內陣列的刪改操作

先做一個初始化,設定一個User類,其初始資料如下: { arr: [ 1, 2 ], _id: 5ac5ee12a79131259413c40f, name: 'scy', __v: 0 } 每次以初始資料為基,進行操作。 1、向內嵌陣列

thinkphp3.2.3版本的資料庫刪改例項

框架thinkphp 版本:3.2.3 內容:資料庫操作 1.多表查詢一條資料 M('a表')->join("b表 on b表.id=a表.id")->where('

elasticsearch java 刪改 版本2

ElasticSearch(名稱太長,後面簡稱ES)作為一個搜尋引擎,目前可謂是如日中天,幾乎和solr齊駕並驅。關於他能做什麼,跟雲端計算有什麼關係,在此不再描述。但是ES的官方文件,特別是關於java的客戶端文件,真是少的可憐,甚至連個完整的增刪改的示例都沒有。在此,

BS(三層)—刪改——Web窗體(aspx)版本

   上一篇我們用一般處理程式寫了(ashx)寫了一遍增刪改查,今天我們將用Web窗體(aspx)寫一遍增刪改查。我們平時寫的時候到底用一般處理程式呢?還是用Web窗體呢?     簡單來說web窗體(aspx)是一般處理程式(ashx)的一個複雜版本

BS(三層)刪改——一般處理程式(ashx)版本

    今天我們學習一下ASP.Net 的增刪改查,這個和以往的CS增刪改查最大的區別就是U層。以往我們學CS的時候都是用的winform窗體,我們可以直接在窗體中新增控制元件。然後針對控制元件的事件屬性進行一系列的操作。到了BS,U層變成了空白的瀏覽器介面,不能直接的拖拉控

Repeater巢狀,刪改綜合運用

<%...@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tra