Torna al Thread

Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' guardo i permessi dell'utente Dim conn As MySqlConnection = New MySqlConnection() Dim conn2 As MySqlConnection = New MySqlConnection() Dim myCommand As New MySqlCommand Dim myAdapter As New MySqlDataAdapter Dim myData As New DataTable Dim myReader As MySqlDataReader Dim Sql As String Dim myCommand2 As New MySqlCommand Dim myAdapter2 As New MySqlDataAdapter Dim myData2 As New DataTable Dim myReader2 As MySqlDataReader Dim Sql2 As String conn.ConnectionString = "server=xxx; user id=xxx; password=xxx; database=xxx" conn2.ConnectionString ="server=xxx; user id=xxx; password=xxx; database=xxx" conn.Open() Try myCommand.Connection = conn Sql = "SELECT * FROM module WHERE module_status=1" myCommand.CommandText = Sql myReader = myCommand.ExecuteReader If myReader.HasRows Then While myReader.Read conn2.Open() myCommand2.Connection = conn2 Sql2 = "SELECT * FROM module,permission WHERE module_id=permission_module AND permission_module=" & myReader.Item("module_id") & " AND permission_user=" & My.Settings.UserID myCommand2.CommandText = Sql2 myReader2 = myCommand2.ExecuteReader If myReader2.HasRows Then While myReader2.Read If myReader2.Item("permission_read") = True Or myReader2.Item("permission_insert") = True Or myReader2.Item("permission_update") = True Or myReader2.Item("permission_delete") = True Then bImpostazioni.Visible = True Else bImpostazioni.Visible = False End If End While End If myReader2.Close() conn2.Close() End While End If Catch myerror As MySqlException ' mostro l'errore sql MsgBox("Error: " & myerror.Message) End Try conn.Close() End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5