您的位置:程序门 -> .net技术 -> asp.net



大家帮帮忙,看看问题出在那里!!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


大家帮帮忙,看看问题出在那里!![已结贴,结贴人:ftg1985]
发表于:2007-03-08 09:22:36 楼主
protected   sub   gridview1_rowdeleting(byval   sender   as   object,   byval   e   as   system.web.ui.webcontrols.gridviewdeleteeventargs)   handles   gridview1.rowdeleting
                dim   id   as   string   =   gridview1.datakeys(e.rowindex).values(0).tostring()  这一句提示错误,"索引超出范围。必须为非负值并小于集合大小。参数名:   index"
                dim   conn   as   string   =   system.configuration.configurationmanager.connectionstrings( "mycon ").tostring()
                dim   myconnection   as   sqlconnection   =   new   sqlconnection(conn)
                myconnection.open()
                dim   mycommand   as   sqlcommand   =   new   sqlcommand( "delete   from   grouptable   where   groupid= "   &   id,   myconnection)
                mycommand.EXECutenonquery()
                myconnection.close()
                gridview1.databind()
        end   sub
发表于:2007-03-08 12:49:561楼 得分:0
草,没人告诉自己也会找到
发表于:2007-03-08 12:56:162楼 得分:0
你这个功能是不是删除当前选择中行。
如果是我也不知道错在哪里,本人看不出来,帮你顶。
发表于:2007-03-08 12:58:223楼 得分:20
protected   void   gridview1_rowdeleting(object   sender,   gridviewdeleteeventargs   e)
        {
                string   userid   =   this.gridview1.datakeys[e.rowindex].tostring();
                oledbconnection   con   =   new   oledbconnection( "provider=microsoft.jet.oledb.4.0;data   source=d:/web/mdb/data.mdb ");
                con.open();
                oledbcommand   cmd   =   new   oledbcommand( "delete   from   login   where   userid= ' "   +   userid   +   " ' ",   con);
                cmd.EXECutenonquery();
                this.gridviewtobind();
        }
用这种方法试试,肯定行
发表于:2007-03-08 16:43:264楼 得分:0
谢谢,"困了也不睡",非常感谢


快速检索

最新资讯
热门点击