当前位置:编程学习 > C#/ASP.NET >>

求这段代码的意思


  public int ExecSQL(global::System.Object tableAdapter,
                                            global::System.String strSQL)
        {
            try
            {
                Type tpAdapter = tableAdapter.GetType();

                tpAdapter.InvokeMember("Connection",
                    BindingFlags.SetProperty |
                    BindingFlags.Public |
                    BindingFlags.NonPublic |
                    BindingFlags.Instance,
                    null, tableAdapter, new global::System.Object[] { this._connection });

                global::System.Data.SqlClient.SqlCommand[] sCommCollection =
                    (global::System.Data.SqlClient.SqlCommand[])tpAdapter.InvokeMember("CommandCollection",
                    BindingFlags.GetProperty |
                    BindingFlags.Public |
                    BindingFlags.NonPublic |
                    BindingFlags.Instance,
                    null, tableAdapter, null);



                global::System.Data.SqlClient.SqlCommand sc = sCommCollection[0].Clone();
                sc.CommandText = strSQL;

                sc.Connection.Open();

                return sc.ExecuteNonQuery();


            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
--------------------编程问答-------------------- 自己UP啊 --------------------编程问答-------------------- 执行sql语句
怎么写这么麻烦,有必要么 --------------------编程问答-------------------- 执行SQL语句啊。。。。。写的真奇怪 --------------------编程问答--------------------  新手 学习学习 呵呵 --------------------编程问答-------------------- 执行SQL语句啊。。。。。不过这种写法很陌生
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,