.NET 學習

.NET 學習生活感想... 万事成蹉跎..... 贵在坚持 及时整理自己做过和学过的东西

博客园 首页 新随笔 联系 订阅 管理
try
            
{
                ArrayList sqlList 
= new ArrayList();
                
string StrSqlTables = "select d.name,a.name FROM   syscolumns   a    left   join   systypes   b   on   a.xtype=b.xusertype " +
                                      
" inner   join   sysobjects   d   on   a.id=d.id     and   d.xtype='U'   and     d.name<>'dtproperties' " +
                                      
"  and a.name = 'rowguid' ";

                
string StrSql = "";

                
string table_NAME = "";
                DataSet ds 
= DbHelperSQL.Query(StrSqlTables);
                
foreach (DataRow row in ds.Tables[0].Rows)
                
{
                    table_NAME 
= row.ItemArray[0].ToString();
                    StrSql 
= "ALTER TABLE " + table_NAME + " DROP COLUMN rowguid ; ";
                    sqlList.Add(StrSql);
                }

                DbHelperSQL.ExecuteSqlTran(sqlList);
                MessageBox.Show(
"删除成功""提示!");
            }

            
catch (Exception ex)
            
{
                MessageBox.Show(
"删除失败  "+ex.Message, "错误!");
            }
posted on 2008-05-29 11:53  Tonyyang  阅读(834)  评论(0编辑  收藏  举报
欢迎转载,转载请注明出处:http://www.cnblogs.com/Tonyyang/