Option Strict Off
Imports System.Data.SqlClient
Public Class 系統執行檔版本管理
    ReadOnly conn As New SqlConnection
    ReadOnly cmd As New SqlCommand
    Dim dr As SqlDataReader
    Private Sub 系統執行檔版本管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "SELECT 系統認證版本號 FROM 版本號管理 "
        cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
        If dr.Read() Then
            Label2.Text = "資料庫版本號 : " & dr("系統認證版本號")
            TextBox2.Text = dr("系統認證版本號")
        End If : conn.Close()
        Target1 = Target & AA(0) & "/"
        Target2 = Target & AA(2) & "/"
        WebBrowser1.Url = New Uri(Target1) : WebBrowser3.Url = New Uri(Target2)
        If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
            WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
        End If
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "UPDATE 版本號管理 SET 系統認證版本號 = N'" & TextBox2.Text & "' WHERE (系統認證版本號 = N'" & Strings.Right(Label2.Text, 10) & "')"
        cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
        conn.Close()

        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "SELECT 系統認證版本號 FROM 版本號管理 "
        cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
        If dr.Read() Then
            Label2.Text = "資料庫版本號 : " & dr("系統認證版本號")
            TextBox2.Text = dr("系統認證版本號")
        End If : conn.Close()
        MsgBox("修改完成")
    End Sub
    Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
        If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
            WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
        End If
    End Sub
End Class