免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
asp.net使用GridView刪除更新ACCESS數(shù)據(jù)庫(kù)里的數(shù)據(jù)問題!急!!!
一個(gè)網(wǎng)站先前用的是MS-SQL現(xiàn)在更換數(shù)據(jù)庫(kù) 為ACCESS 

一個(gè)GridView里面有更新刪除 因?yàn)檎Z法有點(diǎn)不一樣去做了修改 刪除修改好了沒什么問題..但是更新怎么也不行..老提示"語法錯(cuò)誤 (操作符丟失) 在查詢表達(dá)式 'where id="

就是那一堆單引號(hào),和雙銀號(hào)鬧的..大家?guī)臀铱纯?.謝謝啦!

數(shù)據(jù)庫(kù) 字段
    id    txt    date
------------------------
 自動(dòng)編號(hào) 備注   time
代碼:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.OleDb;

public partial class Admin_ad_jj : System.Web.UI.Page
{
    OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + " C:/Documents and Settings/AndersoN/桌面/xf/database/xf.mdb");
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        this.TextBox1.Text = "";
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
       
        con.Open();
        string ad_news = "insert into jj (txt)values('" + this.TextBox1.Text + "')";
        OleDbCommand com = new OleDbCommand(ad_news, con);
        com.ExecuteNonQuery();
        con.Close();
        bind();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        con.Open();
        string sqlstr = "update jj set txt="+((TextBox)(GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim()+"where id="+Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString())+"";
        
        OleDbCommand sqlcom = new OleDbCommand(sqlstr, con);
        sqlcom.ExecuteNonQuery();
        con.Close();
        GridView1.EditIndex = -1;
        bind();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        bind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        con.Open();
        string sqlstr = "delete from jj where id=" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()) + "";
        OleDbCommand com = new OleDbCommand(sqlstr, con );
        com.ExecuteNonQuery();
        con.Close();
        bind();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        bind();
    }
    public void bind()
    {
        string sqlstr = "select * from jj";
        OleDbCommand myda = new OleDbCommand(sqlstr, con);
        con.Open();
        this.GridView1.DataSource = myda.ExecuteReader(); 
        GridView1.DataKeyNames = new string[] { "id" };
        GridView1.DataBind();
        con.Close();
    }
}
在樂山,還在拿三四千工資?試試這個(gè),收入提高好幾倍! 廣告 無極道 · 鹓鶵
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
GridView中選中,編輯,取消,刪除操作?
gridview 編輯,刪除,更新的用法
GridView和下拉菜單DropDownList結(jié)合
GridView事件DataBinding,DataBound,RowCreated,Ro...
使用GridView自帶事件進(jìn)行行定位
GridView 72般絕技
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服