I'm trying to install SQL Server 2008 using vb.net, run SQL Script and backgroundworker
Here is my code:
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim pro1 As System.Diagnostics.Process
pro1 = New System.Diagnostics.Process()
pro1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
pro1.StartInfo.FileName = "CMD"
pro1.StartInfo.Arguments = "/C SQLExpr_x64_enu.exe /QUIET=""TRUE"" /q /ACTION=Install /SkipRules=VSShellInstalledRule RebootRequiredCheck /HIDECONSOLE /FEATURES=SQL /INSTANCENAME=""SQLEXPRESS3"" /SECURITYMODE=""SQL"" /SQLSVCACCOUNT=""NT AUTHORITY\SYSTEM"" /SAPWD=""MYPASS"" /SQLSYSADMINACCOUNTS=""BUILTIN\ADMINISTRATORS"" /ENABLERANU=1 /AGTSVCACCOUNT=""NT AUTHORITY\SYSTEM"" /TCPENABLED=1 /ERRORREPORTING=1 /BROWSERSVCSTARTUPTYPE=""Automatic"""
pro1.Start()
Do While Not pro1.HasExited
ctr = ctr + 1
BackgroundWorker1.ReportProgress(ctr)
Loop
End Sub
I successfully installed SQL Server using this code, but the application does not close when it is already finished.
I want a progress bar that will show the status of the process. I don't have idea how to do this.
Thanks in advance. Please leave a comment if my details are not enough to resolve my problem.