Exemplo n.º 1
0
    protected void gvData_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string SQL = "DELETE AREADATA  WHERE  地號 ='{0}' AND 地段號='{1}' ";

        SQL = string.Format(SQL, e.Values["地號"], e.Values["地段號"]);
        this.lblResult.Text = WebApp.ExceCmd(SQL).ToString();
        DataBind(1);
    }
Exemplo n.º 2
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        // 0地號,1地段名稱,2所有者,3異動時間,4地段號,5ID
        string SQL = "INSERT INTO AREADATA VALUES('{0}','{1}','{2}',{3},'{4}',{5}) ";

        SQL = string.Format(SQL, e.Values["地號"], e.Values["地段名稱"], e.Values["所有者"], "sysdate", e.Values["地段號"], e.Values["行政區"]);
        this.lblResult.Text           = WebApp.ExceCmd(SQL).ToString();
        this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
        //17	仁武區	5480012	2140	仁龍段
    }
Exemplo n.º 3
0
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        string Area = this.ddlArea.SelectedValue; //行政區ID
        string Lot  = this.ddlLot.SelectedValue;  //地段號

        string SQL = "INSERT INTO AREADATA VALUES('{0}','{1}','{2}',{3},'{4}','{5}') ";

        SQL = string.Format(SQL, this.ddlLot.SelectedValue, this.ddlLot.SelectedItem.Text, TextBox3.Text, "sysdate", txtArea.Text, this.ddlArea.SelectedValue);
        this.lblResult.Text           = WebApp.ExceCmd(SQL).ToString();
        this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
        DataBind(1);
    }
Exemplo n.º 4
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string Area = this.ddlArea.SelectedValue; //管轄行政區
        string Orgn = this.ddlOrgn.SelectedValue; //機關

        try
        {
            WebApp.ExceCmd("INSERT INTO R_機關資料_行政區 VALUES(" + Orgn + ", " + Area + ")");
            lblResult.Text = Orgn + ", " + Area;
        }
        catch (Exception ex)
        {
            lblResult.Text = "sql:" + "INSERT INTO R_機關資料_行政區 VALUES(" + Orgn + ", " + Area + ")" + ex.Message;
        }
    }
Exemplo n.º 5
0
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        string ID  = WebApp.GetValue("SELECT MAX(機關ID)+1 FROM 機關資料 ").ToString();
        string SQL = " INSERT INTO 機關資料 ( 機關ID, 名稱, 類別, 地址, 聯絡資訊 ) VALUES ( {0}, '{1}', '{2}', '{3}', '{4}' );  ";

        try {
            SQL = string.Format(SQL, ID, e.Values["名稱"], e.Values["類別"], e.Values["地址"], e.Values["聯絡資訊"]);
            WebApp.ExceCmd(SQL);
            this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
        }
        catch (Exception ex)
        {
            lblResult.Text = SQL + ex.Message;
        }
    }
Exemplo n.º 6
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        string SQL = "UPDATE AREADATA SET 地號='{0}',地段名稱='{1}',所有者='{2}',異動時間={3},地段號='{4}' WHERE 地號='{0}' AND 地段號='{4}'  ";

        try
        {
            SQL = string.Format(SQL, e.NewValues["地號"], e.NewValues["地段名稱"], e.NewValues["所有者"], "sysdate", e.NewValues["地段號"]
                                , e.NewValues["行政區"]);
            this.lblResult.Text           = WebApp.ExceCmd(SQL).ToString();
            this.DetailsView1.Visible     = false;
            this.DetailsView1.DefaultMode = DetailsViewMode.ReadOnly;
            DataBind(1);
        }
        catch (Exception ex)
        {
            lblResult.Text = SQL;
        }
    }