66 messaggi dal 16 gennaio 2007
www.alfavictor.info
Sto' creando una gestione delle mie foto online. La prima form (frmGestMieFotoW) carica i combo con le categorie, sottocategorie e subcategorie ed in base alle selezioni dell'utente carica una griglia con le informazioni di base delle foto corrispondenti.
L'utente seleziona una foto, il cui codice viene passato ad una seconda form (frmGestMieFotoR) che provvede a visualizzare tutti i dati relativi alla foto selezionata per la variazione/cancellazione.

Il problema si verifica nella fase di caricamento dati della seconda form (la prima funziona perfettamente.
L'errore e' localizzato nella fase di caricamento del combo cboSub.
Ho indicato con "Punto Incriminato" il punto ove secondo il debug si verifica l'errore, la riga che scatena l'errore sembea essere sembre diversa.

Di seguito l'html della pagina, il suo codice associato, la classe cMieCategorie e cApriUtenti richiamate e alla fine il codice su cui si ferma, con la descrizione dell'errore segnalato.

Sono giorni che mi dibatto ho provato anche a cancellare il form ed a ricrearlo, ma nienete. Premetto la routine incriminata nella prima pagina funziona perfettamente, e' stata trasferita nella seconda pagina con un taglia ed incolla!!!!!

Pls HELP!!!

Alberto

' La pagina incriminata

l'Html:

<%@ Page Title="" Language="vb" AutoEventWireup="true" MasterPageFile="~/Master/alfavictor.Master" CodeBehind="frmGestMieFotoR.aspx.vb" Inherits="Alfavictor.frmGestMieFotoR" Trace="True" ValidateRequest="True" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="centrato">
<asp:Label ID="lblNomeForm" runat="server" CssClass="NomeForm" Text="GESTIONE FOTO - Variazione / Cancellazione"></asp:Label>

<br />
<table class="Tabella">
<tr>
<td class="TD">
<asp:Label ID="lblIdFoto" runat="server" Text="Codice Foto"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtIdFoto" runat="server" CssClass="textbox" ReadOnly="true"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblNomeFoto" runat="server" Text="Nome Foto"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtNomeFoto" runat="server" CssClass="textbox"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblFoto" runat="server" Text="Foto"></asp:Label>
</td>
<td class="TD1">
<asp:Image ID="Img" runat="server" />
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblDescrizione" runat="server" Text="Descirzione"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtDescrizione" CssClass="textbox400" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblCategoria" runat="server" Text="Categoria"></asp:Label>
</td>
<td class="TD1">
<asp:DropDownList ID="cboCat" runat="server" CssClass="textbox300" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblSC" runat="server" Text="SottoCategoria"></asp:Label>
</td>
<td class="TD1">
<asp:DropDownList ID="cboSc" runat="server" CssClass="textbox300" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblSub" runat="server" Text="Sub Categoria"></asp:Label>
</td>
<td class="TD1">
<asp:DropDownList ID="CboSub" runat="server" CssClass="textbox300" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblUrlFotoGrande" runat="server" Text="Url Foto Grande"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtUrlFotoGrande" CssClass="textbox400" runat="server"></asp:TextBox>
</td>
<tr>
<td class="TD">
<asp:Label ID="lblUrlFotoPiccola" runat="server" Text="Url Foto Piccola"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtUrlFotoPiccola" CssClass="textbox400" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="TD">
<asp:Label ID="lblNomeFotoPiccola" runat="server" Text="Nome Foto Piccola"></asp:Label>
</td>
<td class="TD1">
<asp:TextBox ID="txtNomeFotoPiccola" CssClass="textbox400" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<br />
<asp:Label ID="txtMsg" runat="server" CssClass="errore" Text=""></asp:Label>
<br />
<asp:ImageButton ID="btnUpdate" runat="server" ImageUrl="~/Images/Varia.gif" />
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/Images/Cancella.gif" />
<asp:ImageButton ID="btnClear" runat="server" ImageUrl="~/Images/Svuota.gif"/>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

-------------------------------- Il Codice associato ----------------------------------------------------------

L'errore si verifica all'interno della Routine CaricaSubCategorie che si trova alla fine della routine SVUOTA
Impostando il debug la riva che causa l'errore varia di volta in volta. Mediamente sono le righe che svuotano la combobox cboSub e quelle la carica subito dopo
I valori dei parametri vengono passati regolarmente.
La stessa routine in un altro form funziona correttamente. Ho gia' provato a cancellare la pagina ed a riscriverla ma senza risultato.


Public Class frmGestMieFotoR
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Svuota()
End If
End Sub

Private Sub Svuota()

'Black nella maschera

Me.cboCat.Items.Clear()
Me.cboCat.Text = String.Empty
Me.cboSc.Items.Clear()
Me.cboSc.Text = String.Empty
Me.CboSub.Items.Clear()
Me.CboSub.Text = String.Empty
Me.txtIdFoto.Text = String.Empty
Me.txtDescrizione.Text = String.Empty
Me.txtMsg.Text = String.Empty
Me.txtNomeFoto.Text = String.Empty
Me.txtNomeFotoPiccola.Text = String.Empty
Me.txtUrlFotoGrande.Text = String.Empty
Me.txtUrlFotoPiccola.Text = String.Empty
Me.Img.ImageUrl = String.Empty

'Imposto lo sw wsw = 1 per impedire l'attivazione dell'evento SelectChange dei combo box

wsw = 1

'Carico i dati della foto da Variare / Cancellare


CaricaFoto()

'Carico i combo in funzione dei valori di IdCat, IdSc e IdSub contenuti nella tabella foto

CaricaCategorie()

CaricaSottoCategorie(wIdCategoria)

CaricaSubCategorie(wIdCategoria, wIdSc)

wsw = 0

End Sub

Private Sub CaricaFoto()
Dim cApriUtenti As New cApriUtenti

cApriUtenti.apri()

If cApriUtenti.ErrorNum <> 0 Then
Me.txtMsg.Text = cApriUtenti.ErrorMsg
cApriUtenti.Chiudi()
cApriUtenti = Nothing
Exit Sub
End If

Dim cMieFoto As New cMieFoto
cMieFoto.Connesione = cApriUtenti.connessione

cMieFoto.IdFoto = wIdFoto

cMieFoto.LeggiFotoxIdFoto()

If cMieFoto.ErrorNumber = 0 Then
Me.txtDescrizione.Text = cMieFoto.txtDescrizione
Me.txtIdFoto.Text = cMieFoto.IdFoto
Me.txtMsg.Text = cMieFoto.ErrorMessage
Me.txtNomeFoto.Text = cMieFoto.txtNomeFoto
Me.txtNomeFotoPiccola.Text = cMieFoto.txtNomeFotoPiccola
Me.txtUrlFotoGrande.Text = cMieFoto.txtUrlFotoGrande
Me.txtUrlFotoPiccola.Text = cMieFoto.txtUrlFotoPiccola
Me.Img.ImageUrl = cMieFoto.txtUrlFotoPiccola

wIdCategoria = cMieFoto.IdCategoria
wCat = cMieFoto.txtCategoria
wIdSc = cMieFoto.IdSc
wSc = cMieFoto.txtSc
wIdSub = cMieFoto.IdScSc
wSub = cMieFoto.txtScSc

End If

cMieFoto = Nothing
cApriUtenti.Chiudi()
cApriUtenti = Nothing
End Sub

Private Sub CaricaCategorie()

'Carico il combo delle categorie

Dim cApriUtenti As New cApriUtenti

cApriUtenti.apri()

If cApriUtenti.ErrorNum <> 0 Then
Me.txtMsg.Text = cApriUtenti.ErrorMsg
cApriUtenti.Chiudi()
cApriUtenti = Nothing
Exit Sub
End If

Dim cMieCategorie As New cMieCategorie
Dim wCampo As String
Dim rs As SqlClient.SqlDataReader

cMieCategorie.Connessione = cApriUtenti.connessione

If Not IsDBNull(collCat) Then
collCat = Nothing
End If

collCat = New Collection

wCampo = "..."
Me.cboCat.Items.Clear()
Me.cboCat.Text = String.Empty

Me.cboCat.Items.Add(wCampo)
collCat.Add(0, wCampo)

rs = cMieCategorie.LeggiMieCategorieTutte

Do While rs.Read
wCampo = Replace(rs.Item("txtCat"), "''", "'")
Me.cboCat.Items.Add(wCampo)
collCat.Add(rs.Item("IdCat"), wCampo)
Loop

rs.Close()
rs = Nothing
cMieCategorie = Nothing
cApriUtenti.Chiudi()
cApriUtenti = Nothing

End Sub

Private Sub CaricaSottoCategorie(ByVal IdCategoria As Long)
Dim cApriUtenti As New cApriUtenti

cApriUtenti.apri()

If cApriUtenti.ErrorNum <> 0 Then
Me.txtMsg.Text = cApriUtenti.ErrorMsg
cApriUtenti.Chiudi()
cApriUtenti = Nothing
Exit Sub
End If

Dim cMieCategorie = New cMieCategorie
Dim wcampo As String
Dim rs As SqlClient.SqlDataReader

wcampo = "..."

If Not IsDBNull(collSc) Then
collSc = Nothing
End If

collSc = New Collection

Me.cboSc.Items.Clear()
Me.cboSc.Text = String.Empty

Me.cboSc.Items.Add(wcampo)
collSc.Add(0, wcampo)

cMieCategorie.Connessione = cApriUtenti.connessione
cMieCategorie.IdCategoria = IdCategoria

rs = cMieCategorie.LeggiMieScxIdCat

Do While rs.Read
wcampo = Replace(rs.Item("txtSc"), "''", "'")
Me.cboSc.Items.Add(wcampo)
collSc.Add(rs.Item("IdSc"), wcampo)
Loop

rs.Close()
rs = Nothing
cMieCategorie = Nothing
cApriUtenti.Chiudi()
cApriUtenti = Nothing

End Sub

Private Sub CaricaSubCategorie(ByVal IdCategoria As Long, ByVal IdSottocategoria As Long)
Dim cApri As New cApriUtenti
cApri.apri()
If cApri.ErrorNum <> 0 Then
Me.txtMsg.Text = cApri.ErrorMsg
cApri.Chiudi()
cApri = Nothing
Exit Sub
End If

Dim cMieCategorie As New cMieCategorie
Dim rs As SqlClient.SqlDataReader
Dim wCampo As String
cMieCategorie.Connessione = cApri.connessione

'----------- PUNTO INCRIMINATO --------------------------------------


cMieCategorie.IdCategoria = IdCategoria
cMieCategorie.IdSc = IdSottocategoria
cMieCategorie.txtSub = String.Empty



Me.CboSub.Items.Clear()
Me.CboSub.Text = String.Empty

If Not IsDBNull(collSub) Then
collSub = Nothing
End If

collSub = New Collection

rs = cMieCategorie.LeggiSubxIdSc

wCampo = "..."
Me.CboSub.Items.Add(wCampo)
collSub.Add(0, wCampo)




Do While rs.Read
wCampo = Replace(rs.Item("Sub Categoria"), "''", "'")
Me.CboSub.Items.Add(wCampo)
collSub.Add(rs.Item("ID"), wCampo)
Loop

rs.Close()
rs = Nothing
cMieCategorie = Nothing
cApri.Chiudi()
cApri = Nothing

End Sub

Protected Sub cboCat_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCat.SelectedIndexChanged
If Me.cboCat.SelectedIndex < 0 Or wsw = 1 Then
Exit Sub
End If

CaricaSottoCategorie(collCat(Me.cboCat.Text))


End Sub

Protected Sub cboSc_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboSc.SelectedIndexChanged
If Me.cboSc.SelectedIndex < 0 Or wsw = 1 Then
Exit Sub
End If

CaricaSubCategorie(collCat(Me.cboCat.Text), collSc(Me.cboSc.Text))

End Sub

Protected Sub btnUpdate_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnUpdate.Click

Dim cApriUtenti As New cApriUtenti

cApriUtenti.apri()

If cApriUtenti.ErrorNum <> 0 Then
Me.txtMsg.Text = cApriUtenti.ErrorMsg
cApriUtenti.Chiudi()
cApriUtenti = Nothing
Exit Sub
End If

Dim cMieFoto = New cMieFoto

cMieFoto.Connesione = cApriUtenti.connessione

cMieFoto.IdFoto = wIdFoto
cMieFoto.txtDescrizione = Me.txtDescrizione.Text
cMieFoto.txtNomeFoto = Me.txtNomeFoto.Text
cMieFoto.txtNomeFotoPiccola = Me.txtNomeFotoPiccola.Text
cMieFoto.txtUrlFotoGrande = Me.txtUrlFotoGrande.Text
cMieFoto.txtUrlFotoPiccola = Me.txtUrlFotoPiccola.Text
cMieFoto.IdCategoria = wIdCategoria
cMieFoto.IdSc = wIdSc
cMieFoto.IdScSc = wIdSub

cMieFoto.Update()

Me.txtMsg.Text = cMieFoto.ErrorMessage

cMieFoto = Nothing
cApriUtenti.Chiudi()
cApriUtenti = Nothing

End Sub

Protected Sub btnDelete_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles btnDelete.Click

Dim cApriUtenti As New cApriUtenti

cApriUtenti.apri()

If cApriUtenti.ErrorNum <> 0 Then
Me.txtMsg.Text = cApriUtenti.ErrorMsg
cApriUtenti.Chiudi()
cApriUtenti = Nothing
Exit Sub
End If

Dim cMieFoto = New cMieFoto

cMieFoto.Connesione = cApriUtenti.connessione

cMieFoto.IdFoto = wIdFoto

cMieFoto.Delete()

cMieFoto = Nothing
cApriUtenti.Chiudi()
cApriUtenti = Nothing

End Sub
End Class
Public Class cApriUtenti
'***********************************************************
'*** Classe di Apertura del Database ***
'***********************************************************

Private mConn As SqlConnection
Private mErrorMsg As String
Private mErrorNumber As Long

Public ReadOnly Property ErrorNum() As Long
Get
ErrorNum = mErrorNumber
End Get
End Property
Public ReadOnly Property ErrorMsg() As String
Get
ErrorMsg = mErrorMsg
End Get
End Property

Public ReadOnly Property connessione() As SqlConnection
Get
connessione = mConn
End Get
End Property

'******************************************************************************************
'***** Connection string sul file di config ***
'******************************************************************************************


Public Function apri() As Long
mConn = New SqlConnection
With mConn
.ConnectionString = ConfigurationManager.ConnectionStrings("UtentiConnectionString").ConnectionString
.Open()
End With

If Err.Number <> 0 Then
mErrorNumber = Err.Number
mErrorMsg = Err.Description
End If

If connessione.State = Data.ConnectionState.Open Then
mErrorNumber = 0
mErrorMsg = "Connessione aperta"
Else
mErrorNumber = 1
mErrorMsg = "Connessione chisa"
End If
End Function
Public Function Chiudi() As Long
mConn.Close()
mConn = Nothing
End Function
End Class


'**************************************************************************************************************************************************************
'**** Classe MieCategorie - Permette di leggere, inserire, variare cancellare le Categorie, SottoCategorie e SubCategorie ****
'**************************************************************************************************************************************************************

Public Class cMieCategorie


'**************************************************** Variabili ***********************************************************************************************
#Region "Variabili"
Private mIdCategoria As Integer
Private mIdSc As Integer
Private mIdSub As Integer
Private mtxtCategoria As String
Private mtxtSc As String
Private mtxtSub As String
Private mtxtPwd As String

Private mErrorNumber As Long
Private mErrorLine As Long
Private mErrorState As Long
Private mErrorMessage As String

Private mCmd As SqlClient.SqlCommand
Private mDa As SqlClient.SqlDataAdapter
Private mDt As New DataTable
Private mRs As SqlClient.SqlDataReader
Private mConn As SqlClient.SqlConnection
Private mPar1 As SqlClient.SqlParameter
Private mPar2 As SqlClient.SqlParameter
Private mPar3 As SqlClient.SqlParameter
Private mPar4 As SqlClient.SqlParameter
Private mPar5 As SqlClient.SqlParameter
Private mPar6 As SqlClient.SqlParameter
Private mPar7 As SqlClient.SqlParameter
Private mPar8 As SqlClient.SqlParameter
Private mPar9 As SqlClient.SqlParameter
Private mPar10 As SqlClient.SqlParameter
Private mPar11 As SqlClient.SqlParameter

#End Region

'********************************************************************************* Proprieta' *****************************************************************************

#Region "Proprieta"
Public Property IdCategoria() As Integer
Get
IdCategoria = mIdCategoria
End Get
Set(ByVal value As Integer)
mIdCategoria = value
End Set
End Property

Public Property IdSc() As Integer
Get
IdSc = mIdSc
End Get
Set(ByVal value As Integer)
mIdSc = value
End Set
End Property

Public Property IdSub() As Integer
Get
IdSub = mIdSub
End Get
Set(ByVal value As Integer)
mIdSub = value
End Set
End Property

Public Property txtCategoria() As String
Get
txtCategoria = mtxtCategoria
End Get
Set(ByVal value As String)
mtxtCategoria = Trim(UCase(Replace(value, "'", "''")))
End Set
End Property

Public Property txtSc() As String
Get
txtSc = mtxtSc
End Get
Set(ByVal value As String)
mtxtSc = Trim(UCase(Replace(value, "'", "''")))
End Set
End Property

Public Property txtSub() As String
Get
txtSub = mtxtSub
End Get
Set(ByVal value As String)
mtxtSub = Trim(UCase(Replace(value, "'", "''")))
End Set
End Property

Public Property txtPwd() As String
Get
txtPwd = mtxtPwd
End Get
Set(ByVal value As String)
mtxtPwd = Trim(value)
End Set
End Property

Public WriteOnly Property Connessione() As SqlClient.SqlConnection
Set(ByVal value As SqlClient.SqlConnection)
mConn = value
End Set
End Property

Public ReadOnly Property ErrorNumber() As Long
Get
ErrorNumber = mErrorNumber
End Get
End Property

Public ReadOnly Property ErrorLine() As Long
Get
ErrorLine = mErrorLine
End Get
End Property

Public ReadOnly Property ErrorState() As Long
Get
ErrorState = mErrorState
End Get
End Property

Public ReadOnly Property ErrorMessage() As String
Get
ErrorMessage = mErrorMessage
End Get
End Property
#End Region


'********************************************************************************* Metodi *********************************************************************
#Region "Metodi"

Public Function LeggiMieCategorieTutte() As Object

'********************************************************************************************************************************************************************
'***** Legge la tabella delle categorie, restituisce un RecordSet con tutte le categorie in ordine alfabetico ****
'********************************************************************************************************************************************************************

mCmd = New SqlClient.SqlCommand
mPar1 = New SqlClient.SqlParameter
mPar2 = New SqlClient.SqlParameter
mPar3 = New SqlClient.SqlParameter
mPar4 = New SqlClient.SqlParameter

With mCmd
.Connection = mConn
.CommandText = "spLeggiMieCategorieTutte"
.CommandType = CommandType.StoredProcedure

mPar1 = .CreateParameter
mPar1.ParameterName = "@ErrorNumber"
mPar1.SqlDbType = SqlDbType.BigInt
mPar1.Direction = ParameterDirection.Output
mPar1.Value = mErrorNumber

mPar2 = .CreateParameter
mPar2.ParameterName = "@ErrorLine"
mPar2.SqlDbType = SqlDbType.BigInt
mPar2.Direction = ParameterDirection.Output
mPar2.Value = mErrorLine

mPar3 = .CreateParameter
mPar3.ParameterName = "@ErrorState"
mPar3.SqlDbType = SqlDbType.BigInt
mPar3.Direction = ParameterDirection.Output
mPar3.Value = mErrorState

mPar4 = .CreateParameter
mPar4.ParameterName = "@ErrorMessage"
mPar4.SqlDbType = SqlDbType.VarChar
mPar4.Direction = ParameterDirection.Output
mPar4.Size = 250
mPar4.Value = mErrorMessage

.Parameters.Add(mPar1)
.Parameters.Add(mPar2)
.Parameters.Add(mPar3)
.Parameters.Add(mPar4)

LeggiMieCategorieTutte = .ExecuteReader

End With

mPar1 = Nothing
mPar2 = Nothing
mPar3 = Nothing
mPar4 = Nothing
mCmd = Nothing

End Function


Public Function LeggiSubxIdSc() As Object

'********************************************************************************************************************************************************************************
'**** Legge la tabella delle SubCategorie - Restituisce un RecordSet con tutte le SubCategorie appartenenti alla Categoria, Sottocategoria ****
'**** passate come parametro ****
'********************************************************************************************************************************************************************************




mCmd = New SqlClient.SqlCommand
mPar1 = New SqlClient.SqlParameter
mPar2 = New SqlClient.SqlParameter
mPar3 = New SqlClient.SqlParameter
mPar4 = New SqlClient.SqlParameter
mPar5 = New SqlClient.SqlParameter
mPar6 = New SqlClient.SqlParameter
mPar7 = New SqlClient.SqlParameter

With mCmd
.Connection = mConn
.CommandText = "spLeggiMieCatSubDt"
.CommandType = CommandType.StoredProcedure

mPar1 = .CreateParameter
mPar1.ParameterName = "@ErrorNumber"
mPar1.SqlDbType = SqlDbType.BigInt
mPar1.Direction = ParameterDirection.Output
mPar1.Value = mErrorNumber

mPar2 = .CreateParameter
mPar2.ParameterName = "@ErrorLine"
mPar2.SqlDbType = SqlDbType.BigInt
mPar2.Direction = ParameterDirection.Output
mPar2.Value = mErrorLine

mPar3 = .CreateParameter
mPar3.ParameterName = "@ErrorState"
mPar3.SqlDbType = SqlDbType.BigInt
mPar3.Direction = ParameterDirection.Output
mPar3.Value = mErrorState

mPar4 = .CreateParameter
mPar4.ParameterName = "@ErrorMessage"
mPar4.SqlDbType = SqlDbType.VarChar
mPar4.Direction = ParameterDirection.Output
mPar4.Size = 250
mPar4.Value = mErrorMessage

mPar5 = .CreateParameter
mPar5.ParameterName = "@IdCategoria"
mPar5.SqlDbType = SqlDbType.BigInt
mPar5.Direction = ParameterDirection.Input
mPar5.Value = mIdCategoria

mPar6 = .CreateParameter
mPar6.ParameterName = "@IdSc"
mPar6.SqlDbType = SqlDbType.BigInt
mPar6.Direction = ParameterDirection.Input
mPar6.Value = mIdSc

mPar7 = .CreateParameter
mPar7.ParameterName = "@txtSub"
mPar7.SqlDbType = SqlDbType.VarChar
mPar7.Direction = ParameterDirection.Input
mPar7.Size = Len(mtxtSub)
mPar7.Value = mtxtSub

.Parameters.Add(mPar1)
.Parameters.Add(mPar2)
.Parameters.Add(mPar3)
.Parameters.Add(mPar4)
.Parameters.Add(mPar5)
.Parameters.Add(mPar6)
.Parameters.Add(mPar7)

LeggiSubxIdSc = .ExecuteReader

End With

mPar1 = Nothing
mPar2 = Nothing
mPar3 = Nothing
mPar4 = Nothing
mPar5 = Nothing
mPar6 = Nothing
mPar7 = Nothing
mCmd = Nothing
End Function

Public Function LeggiMieScxIdCat() As Object

'********************************************************************************************************************************************************************************
'**** Legge la tabella delle SottoCategorie - Restituisce un RecordSet con tutte le SubCategorie appartenenti alla Categoria passata come parametro****
'********************************************************************************************************************************************************************************

mCmd = New SqlClient.SqlCommand
mPar1 = New SqlClient.SqlParameter
mPar2 = New SqlClient.SqlParameter
mPar3 = New SqlClient.SqlParameter
mPar4 = New SqlClient.SqlParameter
mPar5 = New SqlClient.SqlParameter

With mCmd
.Connection = mConn
.CommandText = "spLeggiMieSCxIdCat"
.CommandType = CommandType.StoredProcedure

mPar1 = .CreateParameter
mPar1.ParameterName = "@ErrorNumber"
mPar1.SqlDbType = SqlDbType.BigInt
mPar1.Direction = ParameterDirection.Output
mPar1.Value = mErrorNumber

mPar2 = .CreateParameter
mPar2.ParameterName = "@ErrorLine"
mPar2.SqlDbType = SqlDbType.BigInt
mPar2.Direction = ParameterDirection.Output
mPar2.Value = mErrorLine

mPar3 = .CreateParameter
mPar3.ParameterName = "@ErrorState"
mPar3.SqlDbType = SqlDbType.BigInt
mPar3.Direction = ParameterDirection.Output
mPar3.Value = mErrorState

mPar4 = .CreateParameter
mPar4.ParameterName = "@ErrorMessage"
mPar4.SqlDbType = SqlDbType.VarChar
mPar4.Direction = ParameterDirection.Output
mPar4.Size = 250
mPar4.Value = mErrorMessage

mPar5 = .CreateParameter
mPar5.ParameterName = "@IdCat"
mPar5.SqlDbType = SqlDbType.BigInt
mPar5.Direction = ParameterDirection.Input
mPar5.Value = mIdCategoria


.Parameters.Add(mPar1)
.Parameters.Add(mPar2)
.Parameters.Add(mPar3)
.Parameters.Add(mPar4)
.Parameters.Add(mPar5)


LeggiMieScxIdCat = .ExecuteReader

End With


mPar1 = Nothing
mPar2 = Nothing
mPar3 = Nothing
mPar4 = Nothing
mPar5 = Nothing
mCmd = Nothing

End Function



End Class





----------------------------------- Lo stop -------------------------------------------------------------------------
function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
if (this._request === executor.get_webRequest()) {
this._processingRequest = false;
this._additionalInput = null;
this._request = null;
}
var handler = this._get_eventHandlerList().getHandler("endRequest");
var errorHandled = false;
if (handler) {
var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
handler(this, eventArgs);
errorHandled = eventArgs.get_errorHandled();
}
if (error && !errorHandled) {
--> throw error;
}
}

L'errore: error = Sys.WebForms.PageRequestManagerParserErrorException:
Impossibile analizzare il messaggio ricevuto dal server. Le cause più comuni dell'errore sono
la modifica della risposta da parte di chiamate a Response.Write(), i filtri di risposta, gli elementi HttpMod...
5.610 messaggi dal 09 febbraio 2002
Contributi
Ciao, ti premetto che io non ho idea di quale possa essere il problema. Nonostante tu abbia postato tutto il codice, non dispongo comunque del database o di tempo sufficiente per rimettere in piedi l'applicazione con la speranza di poter riprodurre il problema.

La cosa che preferisco fare in questo caso è suggerirti un sistema per identificare il problema in modo che tu possa risolverlo da te.


L'errore: error = Sys.WebForms.PageRequestManagerParserErrorException:
Impossibile analizzare il messaggio ricevuto dal server.


Questo è un errore lato client: Asp.Net Ajax ti avvisa che ha ricevuto una risposta inaspettata. Questo mi fa pensare che lato server si sia verificata un'eccezione e che asp.net, quindi, anziché produrre il normale output di dati abbia stampato tutto quel popò di roba che visualizza di solito (testo dell'errore, stack trace, ecc...).

La prima cosa che devi fare quindi è scoprire qual è il testo di questo errore server. Puoi farlo in due modi:

1. Usa il debugger di Visual Studio. Premi il tasto "play" e lasci girare la tua applicazione. Se si verifica un'eccezione, Visual Studio te la evidenzierà e così saprai qual è il punto preciso in cui intervenire. Mentre se lì, potrai ispezionare le variabili per cercare di capire se contengono i valori previsti.

2. Ispeziona il traffico di rete. Da Internet explorer 9, premi il tasto F12 che farà comparire la console di sviluppo, poi clicca il tasto "Rete" e poi "Avvia cattura". Ora naviga nella tua applicazione, vedrai la griglia della console di sviluppo riempirsi di voci. Ciascuna di esse è una chiamata che la tua applicazione ha fatto al server. Continua a navigare finché la tua applicazione non va in errore. Fai doppioclick sulla voce corrispondente all'errore (in elenco dovrebbe essere l'ultima chiamata ad una pagina aspx) e poi vai nella scheda "Contenuto risposta", così che potrai vedere ciò che il server ha risposto alla chiamata Ajax. Ti renderai conto di qual è l'eccezione, e grazie testo dello stack trace potrai risalire alla linea di codice che ha sollevato il problema.

ciao,
Modificato da BrightSoul il 18 luglio 2011 20.57 -

- So what you're saying is, if we get in trouble, there's no one to help us out?
- I'm afraid not.
- Fantastic!
66 messaggi dal 16 gennaio 2007
www.alfavictor.info
Grazie, ci provo, sono quasi alla disperazione.
66 messaggi dal 16 gennaio 2007
www.alfavictor.info
Non chiedetemi perche', ma ho scoperto che eliminando lo ScriptManager e l'UpdatePanel dalla form chiamante tutto funziona correttamente.

Non e' che la cosa mi riempia di gioia ma cosi' funziona.

Il mistero della Jungla Nera..... :)

Alberto

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.
Community
Ultimi messaggi
UTENTI ONLINE
    In primo piano

    I più letti di oggi

    Media
    In evidenza
    MISC