首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

求"ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!" 里的自定义函数?解决方案

2012-01-19 
求ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子! 里的自定义函数?我在网上看到有好多“AS

求"ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!" 里的自定义函数?
我在网上看到有好多“ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!”,在这个教程的里有好多自定义函数如:GetDs(strSql),RunSql(str),BuilderEdit,BuilderEditClose()等等,请问那位兄弟有这些自定义函数?
那个例子的部分代码如下:
  protected   void   GridView1_RowUpdating(object   sender,   GridViewUpdateEventArgs   e)
        ...{
                string   ID   =   GridView1.DataKeys[e.RowIndex].Values[0].ToString();
                string   DB1_1   =   ((TextBox)GridView1.Rows[e.RowIndex].FindControl( "TextBox1 ")).Text;
                //string   DB1_2   =   ((TextBox)GridView1.Rows[e.RowIndex].FindControl( "TextBox2 ")).Text;
                string   DB1_2   =   (((DropDownList))GridView1.Rows[e.RowIndex].FindControl( "ddlXL ")).SelectedItem.Text;
               
        //判断表单项是否有空并给出提示信息
                if   (DB1_1   ==   " "   ||   DB1_2   ==   " ")
                ...{
                        conn.Alert( "请输入完整信息! ",   Page);
                        return;
                }                          
              try
              ...{
                conn.BuilderEdit( "select   *   from   DB1   where   DB1_1   = ' "   +   ID   +   " ' ");
                conn.dr[ "DB1_1 "]   =   DB1_1;
                conn.dr[ "DB1_2 "]   =   DB1_2;
                conn.BuilderEditClose();
              }
              catch   (OracleException   err)
              ...{
                        if   (err.Code.ToString()   ==   "1 ")
                                conn.Alert( "错误:已存在具有相同主键的记录 ",   Page);
                        else
                                conn.Alert( "错误:未能添加记录 ",   Page);
                }

                Response.Write( " <script   language= 'javascript '> alert( '数据已被保存! '); </script> ");
                //返回浏览状态
                GridView1.EditIndex   =   -1;
                GridViewBind();


        }

[解决办法]
自己寫啊,完全看自己需要什麽
比如GetDs(strSql),應該就是傳sql語句過去,產生並返回一個dataset
寫法基本一樣,無非就算打開數據庫聯接,通過數據庫命令產生dataset
只不過是把這些方法封裝到一個類裏而已
[解决办法]
微软上有个 SqlHelper.cs 找找看

热点排行
Bad Request.