码迷,mamicode.com
首页 > 数据库 > 详细

VB读取sql文并删除

时间:2017-07-26 10:48:57      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:str   rip   exist   task   cmd   man   creat   ons   删除   

 Private Sub UpdateTask()
            Dim connStr As String = ConfigurationManager.connectionStrings("TaxSoftwareConnection").ToString()
            if File.Exists(path)
                Dim file As FileInfo=New FileInfo(path)
                Dim sr As StreamReader = file.OpenText()
                Dim script As String=sr.ReadToEnd()
                Try
                    Dim conn As SqlConnection=new SqlConnection(connStr)
                    conn.Open()
                    Dim cmd As SqlCommand=conn.CreateCommand()
                    cmd.CommandText=script
                    cmd.ExecuteNonQuery()
                    conn.Close()
                Catch ex As Exception
                End Try
                 sr.Close()
                 file.Delete()

            End If
        End Sub

 

VB读取sql文并删除

标签:str   rip   exist   task   cmd   man   creat   ons   删除   

原文地址:http://www.cnblogs.com/SkyLeo/p/7238070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!