Option Strict Off
Imports System.Data.SqlClient
Public Class 系統更新
    Public Property Target1 As String
    Dim conn As New SqlConnection
    Dim cmd As New SqlCommand
    Dim dr As SqlDataReader
    Private Sub 系統更新_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        FormBorderStyle = FormBorderStyle.SizableToolWindow : ControlBox = False
        Target1 = "ftp://192.168.0.43:2121/0001/"
        WebBrowser1.Url = New Uri(Target1)
        If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
            WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
        End If
        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "SELECT 系統認證版本號 FROM 版本號管理01 "
        cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
        If dr.Read() Then
            Label3.Text = "資料庫版本號 : " & dr("系統認證版本號")
            TextBox2.Text = dr("系統認證版本號")
        End If : conn.Close()
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Close()
    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
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "UPDATE 版本號管理01 SET 系統認證版本號 = N'" & TextBox2.Text & "' WHERE (系統認證版本號 = N'" & Strings.Right(Label3.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 版本號管理01 "
        cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
        If dr.Read() Then
            Label3.Text = "資料庫版本號 : " & dr("系統認證版本號")
            TextBox2.Text = dr("系統認證版本號")
        End If : conn.Close()
        MsgBox("修改完成")
    End Sub
End Class