Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Syd Barrett
    Guest

    Cosa sbaglio? si moltiplicano come se avessero vita propria! :-(

    codice:
    Sub VerificaEnte()
            Dim SQL As String
            SQL = "SELECT DISTINCT dbo.DettaglioStruttureApplicazioni.IDStruttura, dbo.Strutture.Nome, dbo.TipoStruttura.Nome AS Tipo" & _
            " FROM dbo.DettaglioUtentiDSA INNER JOIN dbo.DettaglioStruttureApplicazioni ON dbo.DettaglioUtentiDSA.IDDettaglioStrutturaApplicazione = dbo.DettaglioStruttureApplicazioni.IDDettaglioStrutturaApplicazione INNER JOIN" & _
            " dbo.Strutture ON dbo.DettaglioStruttureApplicazioni.IDStruttura = dbo.Strutture.IDStruttura INNER JOIN dbo.TipoStruttura ON dbo.Strutture.IDTipoStruttura = dbo.TipoStruttura.IDTipoStruttura" & _
            " WHERE dbo.DettaglioUtentiDSA.IDDettaglioUtentiDSA = " & Request.Cookies("IDDettaglioUtentiDSA").Value
    
            Conn.Open()
            Dim command As New SqlClient.SqlCommand()
            Dim DRCertificazioni As SqlClient.SqlDataReader
            command.Connection = Conn
            command.CommandText = SQL
            DRCertificazioni = command.ExecuteReader()
            If DRCertificazioni.Read Then
                LblTitolo.Text = DRCertificazioni.Item("Tipo") & " " & DRCertificazioni.Item("Nome")
                IDEnte = DRCertificazioni.Item("IDStruttura") ' riempio la variabile shared con l'id dell'ente di cui fa parte il responsabile
            End If
            DRCertificazioni.Close()
            DRCertificazioni = Nothing
    
            Call PreparaConfronto()
        End Sub
    
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            CSSStilePagina.Text = "<link type=""text/css"" rel=""stylesheet"" href=""" & LeggiStilePagina(Request.Cookies("IDDettaglioUtentiDSA").Value, Modulo.TipoPagina.Contesto) & """>"
            '  If Not Page.IsPostBack Then
            Call VerificaEnte()
            DACertificazioni.Fill(DsCertificazioni)
            Page.DataBind()
            ' End If
        End Sub
    
        Private Sub DGCertificazioni_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGCertificazioni.ItemDataBound
            Dim Indice
            For Each Indice In MioArray
                If e.Item.Cells(0).Text = CStr(Indice) Then
                    Dim Check As New CheckBox()
                    Check.ID = Indice
                    Check.Checked = True
                    e.Item.Cells(1).Controls.Add(Check)
                Else
                    Dim Check As New CheckBox()
                    Check.ID = Indice
                    Check.Checked = False
                    e.Item.Cells(1).Controls.Add(Check)
                End If
            Next
            'If e.Item.Cells(1).Text = String.Empty Then
            '    e.Item.Cells(1).Text = Check
            '    e.Item.Cells(1).Text = e.Item.Cells(1).Text & e.Item.Cells(0).Text & " '>"
            'End If
        End Sub
    
    
        Sub PreparaConfronto()
            Dim SQL2 As String
            SQL2 = "SELECT Certificazioni.IDCertificazione FROM Certificazioni INNER JOIN DettaglioStruttureCertificazioni ON Certificazioni.IDCertificazione ="
            SQL2 = SQL2 & " DettaglioStruttureCertificazioni.IDCertificazione WHERE DettaglioStruttureCertificazioni.IDStruttura =" & IDEnte
    
            Dim Command2 As New SqlClient.SqlCommand()
            Dim DRRiempiArray As SqlClient.SqlDataReader
            Command2.Connection = Conn
            Command2.CommandText = SQL2
            DRRiempiArray = Command2.ExecuteReader()
    
            While DRRiempiArray.Read
                MioArray.Add(DRRiempiArray.Item("IDCertificazione")) ' riempo l'array con gli id delle certificazioni che appartengono al mio ente
            End While
    
            DRRiempiArray.Close()
            DRRiempiArray = Nothing
            Conn.Close()
            Conn = Nothing
        End Sub

  2. #2
    Syd Barrett
    Guest
    anche cos', niente da fare....
    aiuto

    codice:
    Sub VerificaEnte()
            Dim SQL As String
            SQL = "SELECT DISTINCT dbo.DettaglioStruttureApplicazioni.IDStruttura, dbo.Strutture.Nome, dbo.TipoStruttura.Nome AS Tipo" & _
            " FROM dbo.DettaglioUtentiDSA INNER JOIN dbo.DettaglioStruttureApplicazioni ON dbo.DettaglioUtentiDSA.IDDettaglioStrutturaApplicazione = dbo.DettaglioStruttureApplicazioni.IDDettaglioStrutturaApplicazione INNER JOIN" & _
            " dbo.Strutture ON dbo.DettaglioStruttureApplicazioni.IDStruttura = dbo.Strutture.IDStruttura INNER JOIN dbo.TipoStruttura ON dbo.Strutture.IDTipoStruttura = dbo.TipoStruttura.IDTipoStruttura" & _
            " WHERE dbo.DettaglioUtentiDSA.IDDettaglioUtentiDSA = " & Request.Cookies("IDDettaglioUtentiDSA").Value
    
            Conn.Open()
            Dim command As New SqlClient.SqlCommand()
            Dim DRCertificazioni As SqlClient.SqlDataReader
            command.Connection = Conn
            command.CommandText = SQL
            DRCertificazioni = command.ExecuteReader()
            If DRCertificazioni.Read Then
                LblTitolo.Text = DRCertificazioni.Item("Tipo") & " " & DRCertificazioni.Item("Nome")
                IDEnte = DRCertificazioni.Item("IDStruttura") ' riempio la variabile shared con l'id dell'ente di cui fa parte il responsabile
            End If
            DRCertificazioni.Close()
            DRCertificazioni = Nothing
    
            Call PreparaConfronto()
        End Sub
    
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            CSSStilePagina.Text = "<link type=""text/css"" rel=""stylesheet"" href=""" & LeggiStilePagina(Request.Cookies("IDDettaglioUtentiDSA").Value, Modulo.TipoPagina.Contesto) & """>"
    
            DACertificazioni.Fill(DsCertificazioni)
            Page.DataBind()
    
            If Not Page.IsPostBack Then
                Call VerificaEnte()
            Else
                Call PreparaConfronto()
            End If
        End Sub
    
        Private Sub DGCertificazioni_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGCertificazioni.ItemDataBound
            Dim Indice
            For Each Indice In MioArray
                If e.Item.Cells(0).Text = CStr(Indice) Then
                    Dim Check As New CheckBox()
                    Check.ID = Indice
                    Check.Checked = True
                    e.Item.Cells(1).Controls.Add(Check)
                    Exit For
                    'Else
                    '    Dim Check As New CheckBox()
                    '    Check.ID = Indice
                    '    Check.Checked = False
                    '    e.Item.Cells(1).Controls.Add(Check)
                End If
            Next
            'If e.Item.Cells(1).Text = String.Empty Then
            '    e.Item.Cells(1).Text = Check
            '    e.Item.Cells(1).Text = e.Item.Cells(1).Text & e.Item.Cells(0).Text & " '>"
            'End If
        End Sub
    
    
        Sub PreparaConfronto()
            Dim SQL2 As String
            SQL2 = "SELECT Certificazioni.IDCertificazione FROM Certificazioni INNER JOIN DettaglioStruttureCertificazioni ON Certificazioni.IDCertificazione ="
            SQL2 = SQL2 & " DettaglioStruttureCertificazioni.IDCertificazione WHERE DettaglioStruttureCertificazioni.IDStruttura =" & IDEnte
    
            Dim Command2 As New SqlClient.SqlCommand()
            Dim DRRiempiArray As SqlClient.SqlDataReader
            Command2.Connection = Conn
            Command2.CommandText = SQL2
            DRRiempiArray = Command2.ExecuteReader()
    
            While DRRiempiArray.Read
                MioArray.Add(DRRiempiArray.Item("IDCertificazione")) ' riempo l'array con gli id delle certificazioni che appartengono al mio ente
            End While
    
            DRRiempiArray.Close()
            DRRiempiArray = Nothing
            Conn.Close()
            Conn = Nothing
        End Sub

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482
    Chi posta troppo codice e chi niente:tongue:

    dov'è il problema?

    Hey hey, my my Rock and roll can never die!

  4. #4
    Syd Barrett
    Guest
    oooh, grazie dell'interessamento
    In pratica c'è un datagrid.... con delle checkbox....
    queste devono essere "checcate o meno" a seconda dell'utente, mentre comunque sono tutte visibili.
    Peccato che così come ho fatto io, le chechbox sembrano gremlins.
    Mi puoi aiutare?

  5. #5
    Syd Barrett
    Guest
    e ora?

    codice:
      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            CSSStilePagina.Text = "<link type=""text/css"" rel=""stylesheet"" href=""" & LeggiStilePagina(Request.Cookies("IDDettaglioUtentiDSA").Value, Modulo.TipoPagina.Contesto) & """>"
            Call VerificaEnte()
            DACertificazioni.Fill(DsCertificazioni)
            Page.DataBind()
        End Sub
    
        Sub VerificaEnte()
            Dim SQL As String
            SQL = "SELECT DISTINCT dbo.DettaglioStruttureApplicazioni.IDStruttura, dbo.Strutture.Nome, dbo.TipoStruttura.Nome AS Tipo" & _
            " FROM dbo.DettaglioUtentiDSA INNER JOIN dbo.DettaglioStruttureApplicazioni ON dbo.DettaglioUtentiDSA.IDDettaglioStrutturaApplicazione = dbo.DettaglioStruttureApplicazioni.IDDettaglioStrutturaApplicazione INNER JOIN" & _
            " dbo.Strutture ON dbo.DettaglioStruttureApplicazioni.IDStruttura = dbo.Strutture.IDStruttura INNER JOIN dbo.TipoStruttura ON dbo.Strutture.IDTipoStruttura = dbo.TipoStruttura.IDTipoStruttura" & _
            " WHERE dbo.DettaglioUtentiDSA.IDDettaglioUtentiDSA = " & Request.Cookies("IDDettaglioUtentiDSA").Value
    
            Conn.Open()
            Dim command As New SqlClient.SqlCommand()
            Dim DRCertificazioni As SqlClient.SqlDataReader
            command.Connection = Conn
            command.CommandText = SQL
            DRCertificazioni = command.ExecuteReader()
            If DRCertificazioni.Read Then
                LblTitolo.Text = DRCertificazioni.Item("Tipo") & " " & DRCertificazioni.Item("Nome")
                IDEnte = DRCertificazioni.Item("IDStruttura") ' riempio la variabile shared con l'id dell'ente di cui fa parte il responsabile
            End If
            DRCertificazioni.Close()
            DRCertificazioni = Nothing
    
            Conn.Close()
    
            Call PreparaConfronto()
        End Sub
    
    
        Private Sub DGCertificazioni_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGCertificazioni.ItemDataBound
            Dim Indice
            For Each Indice In MioArray
                If Not e.Item.Cells(1) Is String.Empty Then
                    If e.Item.Cells(0).Text = CStr(Indice) Then
                        Dim Check As New CheckBox()
                        Check.ID = Indice
                        Check.Checked = True
                        e.Item.Cells(1).Controls.Add(Check)
                        Exit For
                    Else
                        Dim Check As New CheckBox()
                        Check.ID = Indice
                        Check.Checked = False
                        e.Item.Cells(1).Controls.Add(Check)
                        Exit For
                    End If
                End If
            Next
            'If e.Item.Cells(1).Text = String.Empty Then
            '    e.Item.Cells(1).Text = Check
            '    e.Item.Cells(1).Text = e.Item.Cells(1).Text & e.Item.Cells(0).Text & " '>"
            'End If
        End Sub
    
    
        Sub PreparaConfronto()
            Dim SQL2 As String
    
            Conn.Open()
            SQL2 = "SELECT Certificazioni.IDCertificazione FROM Certificazioni INNER JOIN DettaglioStruttureCertificazioni ON Certificazioni.IDCertificazione ="
            SQL2 = SQL2 & " DettaglioStruttureCertificazioni.IDCertificazione WHERE DettaglioStruttureCertificazioni.IDStruttura =" & IDEnte
    
            Dim Command2 As New SqlClient.SqlCommand()
            Dim DRRiempiArray As SqlClient.SqlDataReader
            Command2.Connection = Conn
            Command2.CommandText = SQL2
            DRRiempiArray = Command2.ExecuteReader()
    
            While DRRiempiArray.Read
                MioArray.Add(DRRiempiArray.Item("IDCertificazione")) ' riempo l'array con gli id delle certificazioni che appartengono al mio ente
            End While
    
            DRRiempiArray.Close()
            DRRiempiArray = Nothing
            Conn.Close()
            Conn = Nothing
        End Sub

  6. #6
    Syd Barrett
    Guest
    mi dite almeno se questo ha senso?
    no, perchè non fuziona.

    codice:
     Private Sub DGCertificazioni_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGCertificazioni.ItemDataBound
            Dim Indice
            Dim Check As New CheckBox()
    
            For Each Indice In MioArray
                'For Indice = 1 To MioArray.Count
                Check.ID = Indice
                If e.Item.Cells(0).Text = CStr(MioArray(Indice)) Then
                    Check.Checked = True
                    e.Item.Cells(1).Controls.Add(Check)
                Else
                    Check.Checked = False
                    e.Item.Cells(1).Controls.Add(Check)
                End If
            Next
    
        End Sub

  7. #7
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482
    MioArray è un ArrayList?

    Questo pezzo penso sia sbagliato:

    codice:
    ....
    If e.Item.Cells(0).Text = CStr(MioArray(Indice)) Then
    ....
    Forse così:

    codice:
    ....
    Dim Valore as String
    ....
    For Each Valore In MioArray
    ....
    If e.Item.Cells(0).Text = CStr(Valore) Then
    ....

    Hey hey, my my Rock and roll can never die!

  8. #8
    Syd Barrett
    Guest
    è un array.
    praticamente devo confrontare il valore di una "riga" di un dataset con dei valori che ho nell'array.
    se è uguale, metto la checkbox checcata, se no no.

  9. #9
    Syd Barrett
    Guest
    [supersaibal]Originariamente inviato da Syd Barrett
    è un array.
    praticamente devo confrontare il valore di una "riga" di un dataset con dei valori che ho nell'array.
    se è uguale, metto la checkbox checcata, se no no. [/supersaibal]


    ora mi dice

    Index non compreso nell'intervallo. Richiesto valore non negativo e minore della dimensione dell'insieme. Nome parametro: index

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.