Torna al Thread

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '==========AVVIO LA CONNESSIONE AL DATABASE========== Me.ProgressBa.Visible = True Me.BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork connessione() End Sub Private Sub connessione() Try REM Db.ConnectionString = " Data Source=apollo;Initial Catalog=c59onlinefr;Integrated Security=SSPI;" Db.ConnectionString = "Data Source=SQLB10.WEBCONTROLCENTER.COM,1433;Network Library=DBMSSOCN;Initial Catalog=C59onlinefr;User ID=trinity;Password=skyangel;" Db.Open() Catch MessageBox.Show("Attenzione impossibile collegarsi al database dell'Apt di Frosinone", "C59.Net", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Try If Db.State = ConnectionState.Closed = True Then MessageBox.Show("Connessione non attivata", "C59.Net", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.ToolStripStatusLabel1.Text = "Connessione al database non attiva" Me.ToolStripStatusLabel1.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\image\db_remove.png") Return End If If Db.State = ConnectionState.Open = True Then Me.ToolStripButton3.Enabled = True Me.ToolStripStatusLabel1.Text = "Connessione al database attiva" Me.ToolStripStatusLabel1.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\image\db_add.png") Me.Panel1.Visible = False End If End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5