Bonjour,
Lorsque je sors de n'importe quel traitement sur mon web form, je me
retrouve avec une alert windows "stack overflow : line 0". J'ai vérifié mon
code pour voir si je n'aavais rien de récursif et je n'ai rien trouvé. J'ai
testé ma webform dans Netscape et je n'ai aucune erreur par contre sur un
autre serveur en IE c'est la même erreur...c'est à ne rien comprendre.
Quelqu'un pourrait-il m'aider ou jeter un coup d'oeil à mon code au cas ou...
Merci.
code (datagrid avec tri, résulatas affichés par N° de semaine, sous datagrid
dans controle utilisateur et total par colonnes) :
'déclaration des variables liées à l'identité client
Dim se As String
Dim cli As String
' déclaration variables pour sub displaytotal
Dim sumcol As Integer = 0
Dim sumpds As Decimal = 0
Dim sumvol As Decimal = 0
#Region " Code généré par le Concepteur Web Form "
'Cet appel est requis par le Concepteur Web Form.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Dim configurationAppSettings As
System.Configuration.AppSettingsReader = New
System.Configuration.AppSettingsReader
Me.conn = New System.Data.SqlClient.SqlConnection
Me.da = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.ds = New PLANNING.ds
Me.cmdmodif = New System.Data.SqlClient.SqlCommand
Me.sqlconn = New System.Data.SqlClient.SqlConnection
CType(Me.ds,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'da
'
Me.da.SelectCommand = Me.SqlSelectCommand1
Me.da.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "TAB_CONT", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("ID_CONT", "ID_CONT"), New
System.Data.Common.DataColumnMapping("DATE_CONT", "DATE_CONT"), New
System.Data.Common.DataColumnMapping("HEURE_CONT", "HEURE_CONT"), New
System.Data.Common.DataColumnMapping("TC_CONT", "TC_CONT"), New
System.Data.Common.DataColumnMapping("MS_CONT", "MS_CONT"), New
System.Data.Common.DataColumnMapping("PORT_CONT", "PORT_CONT"), New
System.Data.Common.DataColumnMapping("DARR_CONT", "DARR_CONT"), New
System.Data.Common.DataColumnMapping("ETD", "ETD"), New
System.Data.Common.DataColumnMapping("eta", "eta"), New
System.Data.Common.DataColumnMapping("NBCOL_CONT", "NBCOL_CONT"), New
System.Data.Common.DataColumnMapping("PDS_CONT", "PDS_CONT"), New
System.Data.Common.DataColumnMapping("VOL_CONT", "VOL_CONT"), New
System.Data.Common.DataColumnMapping("PRIOR_CONT", "PRIOR_CONT"), New
System.Data.Common.DataColumnMapping("COMMENT_CONT", "COMMENT_CONT")})})
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY TC_CONT, NATURE_CONT"
Me.SqlSelectCommand1.Connection = Me.conn
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@session",
System.Data.SqlDbType.NVarChar, 10, "SESSION_CONT"))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@sem", System.Data.SqlDbType.NVarChar,
10, "SEM_CONT"))
'
'ds
'
Me.ds.DataSetName = "ds"
Me.ds.Locale = New System.Globalization.CultureInfo("fr-FR")
'
'sqlconn
'
Me.sqlconn.ConnectionString =
CType(configurationAppSettings.GetValue("conn", GetType(System.String)),
String)
'
CType(Me.ds, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Protected WithEvents conn As System.Data.SqlClient.SqlConnection
Protected WithEvents da As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents ds As PLANNING.ds
Protected WithEvents hl_visu As System.Web.UI.WebControls.HyperLink
Protected WithEvents SqlSelectCommand1 As
System.Data.SqlClient.SqlCommand
Protected WithEvents cmdmodif As System.Data.SqlClient.SqlCommand
Protected WithEvents RequiredFieldValidator1 As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents CompareValidator1 As
System.Web.UI.WebControls.CompareValidator
Protected WithEvents sqlconn As System.Data.SqlClient.SqlConnection
Protected WithEvents sqlcmd1 As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdNext As New SqlCommand
Protected WithEvents cmdPrevious As New SqlCommand
Protected WithEvents conn1 As IBM.Data.DB2.DB2Connection
Protected WithEvents conn3 As IBM.Data.DB2.DB2Connection
Protected WithEvents conn2 As IBM.Data.DB2.DB2Connection
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load, Me.Load
se = Request.QueryString("SE")
cli = Request.QueryString("CLI")
Dim aujourd As Date
aujourd = Date.Now
If Not Page.IsPostBack Then
' appel de la fonction récup
recup()
' appel de la fonction binddata avec txtsem = semaine en cours
txtsem.Text = DatePart("ww", aujourd)
binddata()
End If
End Sub
Sub binddata()
da.SelectCommand.Parameters("@session").Value = se
da.SelectCommand.Parameters("@sem").Value = txtsem.Text
' Tri par colonne
If t.Text <> "" Then
da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY " & t.Text & " "
' remplir le datagrid
da.Fill(ds)
DataBind()
Else
da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY NATURE_CONT,TC_CONT "
' remplir le datagrid
da.Fill(ds)
DataBind()
End If
' texte des boutons de navigation par semaine
sem.Text = txtsem.Text
btnNext.Text = "Semaine " & txtsem.Text + 1
btnPrevious.Text = "Semaine " & txtsem.Text - 1
End Sub
Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound
Try
' recupération des N° de commandes associés aux TC du datagrid
Dim lbl As Label = e.Item.Cells(5).FindControl("lblcmd")
Dim sqlcmd As New SqlCommand
sqlcmd.Connection = sqlconn
Dim drsqlcmd As SqlDataReader
If Not lbl Is Nothing Then
sqlcmd.CommandText = "select NUM_CMD from TAB_CMD where
CONT_CMD='" & DataBinder.Eval(e.Item.DataItem, "TC_CONT") & "' and
SESSION_CMD='" & se & "'"
sqlconn.Open()
drsqlcmd = sqlcmd.ExecuteReader
Do While drsqlcmd.Read
' affichage des N° de commande dans un controle
Label du Datagrid
lbl.Text = drsqlcmd(0) & "<br>" & lbl.Text
Loop
drsqlcmd.Close()
sqlconn.Close()
End If
' Calcul total colis/poids/volume par colonne
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If Not DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT") Is
System.DBNull.Value Then
sumcol +=
Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT"))
End If
If Not DataBinder.Eval(e.Item.DataItem, "PDS_CONT") Is
System.DBNull.Value Then
sumpds +=
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "PDS_CONT"))
End If
If Not DataBinder.Eval(e.Item.DataItem, "VOL_CONT") Is
System.DBNull.Value Then
sumvol +=
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "VOL_CONT"))
End If
ElseIf e.Item.ItemType = ListItemType.Footer Then
e.Item.Cells(1).Text = "Total : "
e.Item.Cells(10).Text = String.Format("{0:g}", sumcol)
e.Item.Cells(11).Text = String.Format("{0:g}", sumpds)
e.Item.Cells(12).Text = String.Format("{0:g}", sumvol)
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
' appel de la fonction binddata avec nouvelle valeur de semaine
txtsem.Text = txtsem.Text + 1
sem.Text = txtsem.Text
binddata()
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPrevious.Click
' appel de la fonction binddata avec nouvelle valeur de semaine
txtsem.Text = txtsem.Text - 1
sem.Text = txtsem.Text
binddata()
End Sub
Private Sub dg_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles dg.SelectedIndexChanged
' affichage des détails TC
err.Text = ""
binddata()
If dg.SelectedIndex <> -1 Then
' Mise en forme et appel du "sous datagrid"
Dim oDGItem As New DataGridItem(0, 0, ListItemType.Item)
Dim oCell As New TableCell
oCell.HorizontalAlign = HorizontalAlign.Right
oCell.ColumnSpan = dg.Columns.Count
oCell.BackColor = dg.SelectedItemStyle.BackColor
oDGItem.Cells.Add(oCell)
Dim id As String
id = ds.TAB_CONT(dg.SelectedIndex)("TC_CONT")
id = id & "_" & se
Dim oC As cmd2 = CType(Page.LoadControl("cmd2.ascx"), cmd2)
oC.IDc = id
oC.DataBind()
oCell.Controls.Add(oC)
dg.Controls(0).Controls.AddAt(dg.SelectedIndex + 3, oDGItem)
End If
End Sub
Private Sub dg_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand
' recup du paramètre pour le tri du datagrid
Dim txt As String
txt = e.SortExpression
t.Text = txt
binddata()
End Sub
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Mamaw
En fait j'ai trouvé, il suffisant de passer le "EnableSessionState" de True à False.
"Mamaw" a écrit :
Bonjour, Lorsque je sors de n'importe quel traitement sur mon web form, je me retrouve avec une alert windows "stack overflow : line 0". J'ai vérifié mon code pour voir si je n'aavais rien de récursif et je n'ai rien trouvé. J'ai testé ma webform dans Netscape et je n'ai aucune erreur par contre sur un autre serveur en IE c'est la même erreur...c'est à ne rien comprendre. Quelqu'un pourrait-il m'aider ou jeter un coup d'oeil à mon code au cas ou... Merci.
code (datagrid avec tri, résulatas affichés par N° de semaine, sous datagrid dans controle utilisateur et total par colonnes) :
'déclaration des variables liées à l'identité client Dim se As String Dim cli As String
' déclaration variables pour sub displaytotal Dim sumcol As Integer = 0 Dim sumpds As Decimal = 0 Dim sumvol As Decimal = 0
#Region " Code généré par le Concepteur Web Form "
'Cet appel est requis par le Concepteur Web Form. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader Me.conn = New System.Data.SqlClient.SqlConnection Me.da = New System.Data.SqlClient.SqlDataAdapter Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.ds = New PLANNING.ds Me.cmdmodif = New System.Data.SqlClient.SqlCommand Me.sqlconn = New System.Data.SqlClient.SqlConnection CType(Me.ds, System.ComponentModel.ISupportInitialize).BeginInit() ' 'da ' Me.da.SelectCommand = Me.SqlSelectCommand1 Me.da.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "TAB_CONT", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ID_CONT", "ID_CONT"), New System.Data.Common.DataColumnMapping("DATE_CONT", "DATE_CONT"), New System.Data.Common.DataColumnMapping("HEURE_CONT", "HEURE_CONT"), New System.Data.Common.DataColumnMapping("TC_CONT", "TC_CONT"), New System.Data.Common.DataColumnMapping("MS_CONT", "MS_CONT"), New System.Data.Common.DataColumnMapping("PORT_CONT", "PORT_CONT"), New System.Data.Common.DataColumnMapping("DARR_CONT", "DARR_CONT"), New System.Data.Common.DataColumnMapping("ETD", "ETD"), New System.Data.Common.DataColumnMapping("eta", "eta"), New System.Data.Common.DataColumnMapping("NBCOL_CONT", "NBCOL_CONT"), New System.Data.Common.DataColumnMapping("PDS_CONT", "PDS_CONT"), New System.Data.Common.DataColumnMapping("VOL_CONT", "VOL_CONT"), New System.Data.Common.DataColumnMapping("PRIOR_CONT", "PRIOR_CONT"), New System.Data.Common.DataColumnMapping("COMMENT_CONT", "COMMENT_CONT")})}) ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY TC_CONT, NATURE_CONT" Me.SqlSelectCommand1.Connection = Me.conn Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@session", System.Data.SqlDbType.NVarChar, 10, "SESSION_CONT")) Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@sem", System.Data.SqlDbType.NVarChar, 10, "SEM_CONT")) ' 'ds ' Me.ds.DataSetName = "ds" Me.ds.Locale = New System.Globalization.CultureInfo("fr-FR") ' 'sqlconn ' Me.sqlconn.ConnectionString = CType(configurationAppSettings.GetValue("conn", GetType(System.String)), String) ' CType(Me.ds, System.ComponentModel.ISupportInitialize).EndInit()
End Sub Protected WithEvents conn As System.Data.SqlClient.SqlConnection Protected WithEvents da As System.Data.SqlClient.SqlDataAdapter Protected WithEvents ds As PLANNING.ds Protected WithEvents hl_visu As System.Web.UI.WebControls.HyperLink Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents cmdmodif As System.Data.SqlClient.SqlCommand Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator Protected WithEvents CompareValidator1 As System.Web.UI.WebControls.CompareValidator Protected WithEvents sqlconn As System.Data.SqlClient.SqlConnection Protected WithEvents sqlcmd1 As System.Data.SqlClient.SqlCommand Protected WithEvents cmdNext As New SqlCommand Protected WithEvents cmdPrevious As New SqlCommand Protected WithEvents conn1 As IBM.Data.DB2.DB2Connection Protected WithEvents conn3 As IBM.Data.DB2.DB2Connection Protected WithEvents conn2 As IBM.Data.DB2.DB2Connection
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load se = Request.QueryString("SE") cli = Request.QueryString("CLI") Dim aujourd As Date aujourd = Date.Now
If Not Page.IsPostBack Then ' appel de la fonction récup recup() ' appel de la fonction binddata avec txtsem = semaine en cours txtsem.Text = DatePart("ww", aujourd) binddata() End If End Sub
Sub binddata() da.SelectCommand.Parameters("@session").Value = se da.SelectCommand.Parameters("@sem").Value = txtsem.Text
' Tri par colonne If t.Text <> "" Then da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY " & t.Text & " " ' remplir le datagrid da.Fill(ds) DataBind() Else da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY NATURE_CONT,TC_CONT " ' remplir le datagrid da.Fill(ds) DataBind() End If
' texte des boutons de navigation par semaine sem.Text = txtsem.Text btnNext.Text = "Semaine " & txtsem.Text + 1 btnPrevious.Text = "Semaine " & txtsem.Text - 1 End Sub
Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound Try ' recupération des N° de commandes associés aux TC du datagrid Dim lbl As Label = e.Item.Cells(5).FindControl("lblcmd") Dim sqlcmd As New SqlCommand sqlcmd.Connection = sqlconn Dim drsqlcmd As SqlDataReader If Not lbl Is Nothing Then sqlcmd.CommandText = "select NUM_CMD from TAB_CMD where CONT_CMD='" & DataBinder.Eval(e.Item.DataItem, "TC_CONT") & "' and SESSION_CMD='" & se & "'"
sqlconn.Open() drsqlcmd = sqlcmd.ExecuteReader Do While drsqlcmd.Read
' affichage des N° de commande dans un controle Label du Datagrid lbl.Text = drsqlcmd(0) & "<br>" & lbl.Text Loop drsqlcmd.Close() sqlconn.Close() End If
' Calcul total colis/poids/volume par colonne If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then If Not DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT") Is System.DBNull.Value Then sumcol += Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT")) End If If Not DataBinder.Eval(e.Item.DataItem, "PDS_CONT") Is System.DBNull.Value Then sumpds += Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "PDS_CONT")) End If If Not DataBinder.Eval(e.Item.DataItem, "VOL_CONT") Is System.DBNull.Value Then sumvol += Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "VOL_CONT")) End If ElseIf e.Item.ItemType = ListItemType.Footer Then e.Item.Cells(1).Text = "Total : " e.Item.Cells(10).Text = String.Format("{0:g}", sumcol) e.Item.Cells(11).Text = String.Format("{0:g}", sumpds) e.Item.Cells(12).Text = String.Format("{0:g}", sumvol) End If Catch ex As Exception Response.Write(ex.Message) End Try End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click ' appel de la fonction binddata avec nouvelle valeur de semaine txtsem.Text = txtsem.Text + 1 sem.Text = txtsem.Text binddata() End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click ' appel de la fonction binddata avec nouvelle valeur de semaine txtsem.Text = txtsem.Text - 1 sem.Text = txtsem.Text binddata() End Sub
Private Sub dg_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dg.SelectedIndexChanged ' affichage des détails TC err.Text = "" binddata() If dg.SelectedIndex <> -1 Then
' Mise en forme et appel du "sous datagrid" Dim oDGItem As New DataGridItem(0, 0, ListItemType.Item) Dim oCell As New TableCell oCell.HorizontalAlign = HorizontalAlign.Right oCell.ColumnSpan = dg.Columns.Count oCell.BackColor = dg.SelectedItemStyle.BackColor oDGItem.Cells.Add(oCell) Dim id As String id = ds.TAB_CONT(dg.SelectedIndex)("TC_CONT") id = id & "_" & se Dim oC As cmd2 = CType(Page.LoadControl("cmd2.ascx"), cmd2) oC.IDc = id oC.DataBind() oCell.Controls.Add(oC) dg.Controls(0).Controls.AddAt(dg.SelectedIndex + 3, oDGItem) End If End Sub
Private Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand ' recup du paramètre pour le tri du datagrid Dim txt As String txt = e.SortExpression t.Text = txt binddata() End Sub
En fait j'ai trouvé, il suffisant de passer le "EnableSessionState" de True à
False.
"Mamaw" a écrit :
Bonjour,
Lorsque je sors de n'importe quel traitement sur mon web form, je me
retrouve avec une alert windows "stack overflow : line 0". J'ai vérifié mon
code pour voir si je n'aavais rien de récursif et je n'ai rien trouvé. J'ai
testé ma webform dans Netscape et je n'ai aucune erreur par contre sur un
autre serveur en IE c'est la même erreur...c'est à ne rien comprendre.
Quelqu'un pourrait-il m'aider ou jeter un coup d'oeil à mon code au cas ou...
Merci.
code (datagrid avec tri, résulatas affichés par N° de semaine, sous datagrid
dans controle utilisateur et total par colonnes) :
'déclaration des variables liées à l'identité client
Dim se As String
Dim cli As String
' déclaration variables pour sub displaytotal
Dim sumcol As Integer = 0
Dim sumpds As Decimal = 0
Dim sumvol As Decimal = 0
#Region " Code généré par le Concepteur Web Form "
'Cet appel est requis par le Concepteur Web Form.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Dim configurationAppSettings As
System.Configuration.AppSettingsReader = New
System.Configuration.AppSettingsReader
Me.conn = New System.Data.SqlClient.SqlConnection
Me.da = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.ds = New PLANNING.ds
Me.cmdmodif = New System.Data.SqlClient.SqlCommand
Me.sqlconn = New System.Data.SqlClient.SqlConnection
CType(Me.ds,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'da
'
Me.da.SelectCommand = Me.SqlSelectCommand1
Me.da.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "TAB_CONT", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("ID_CONT", "ID_CONT"), New
System.Data.Common.DataColumnMapping("DATE_CONT", "DATE_CONT"), New
System.Data.Common.DataColumnMapping("HEURE_CONT", "HEURE_CONT"), New
System.Data.Common.DataColumnMapping("TC_CONT", "TC_CONT"), New
System.Data.Common.DataColumnMapping("MS_CONT", "MS_CONT"), New
System.Data.Common.DataColumnMapping("PORT_CONT", "PORT_CONT"), New
System.Data.Common.DataColumnMapping("DARR_CONT", "DARR_CONT"), New
System.Data.Common.DataColumnMapping("ETD", "ETD"), New
System.Data.Common.DataColumnMapping("eta", "eta"), New
System.Data.Common.DataColumnMapping("NBCOL_CONT", "NBCOL_CONT"), New
System.Data.Common.DataColumnMapping("PDS_CONT", "PDS_CONT"), New
System.Data.Common.DataColumnMapping("VOL_CONT", "VOL_CONT"), New
System.Data.Common.DataColumnMapping("PRIOR_CONT", "PRIOR_CONT"), New
System.Data.Common.DataColumnMapping("COMMENT_CONT", "COMMENT_CONT")})})
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY TC_CONT, NATURE_CONT"
Me.SqlSelectCommand1.Connection = Me.conn
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@session",
System.Data.SqlDbType.NVarChar, 10, "SESSION_CONT"))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@sem", System.Data.SqlDbType.NVarChar,
10, "SEM_CONT"))
'
'ds
'
Me.ds.DataSetName = "ds"
Me.ds.Locale = New System.Globalization.CultureInfo("fr-FR")
'
'sqlconn
'
Me.sqlconn.ConnectionString =
CType(configurationAppSettings.GetValue("conn", GetType(System.String)),
String)
'
CType(Me.ds, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Protected WithEvents conn As System.Data.SqlClient.SqlConnection
Protected WithEvents da As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents ds As PLANNING.ds
Protected WithEvents hl_visu As System.Web.UI.WebControls.HyperLink
Protected WithEvents SqlSelectCommand1 As
System.Data.SqlClient.SqlCommand
Protected WithEvents cmdmodif As System.Data.SqlClient.SqlCommand
Protected WithEvents RequiredFieldValidator1 As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents CompareValidator1 As
System.Web.UI.WebControls.CompareValidator
Protected WithEvents sqlconn As System.Data.SqlClient.SqlConnection
Protected WithEvents sqlcmd1 As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdNext As New SqlCommand
Protected WithEvents cmdPrevious As New SqlCommand
Protected WithEvents conn1 As IBM.Data.DB2.DB2Connection
Protected WithEvents conn3 As IBM.Data.DB2.DB2Connection
Protected WithEvents conn2 As IBM.Data.DB2.DB2Connection
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load, Me.Load
se = Request.QueryString("SE")
cli = Request.QueryString("CLI")
Dim aujourd As Date
aujourd = Date.Now
If Not Page.IsPostBack Then
' appel de la fonction récup
recup()
' appel de la fonction binddata avec txtsem = semaine en cours
txtsem.Text = DatePart("ww", aujourd)
binddata()
End If
End Sub
Sub binddata()
da.SelectCommand.Parameters("@session").Value = se
da.SelectCommand.Parameters("@sem").Value = txtsem.Text
' Tri par colonne
If t.Text <> "" Then
da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY " & t.Text & " "
' remplir le datagrid
da.Fill(ds)
DataBind()
Else
da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE
(TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND
(SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY NATURE_CONT,TC_CONT "
' remplir le datagrid
da.Fill(ds)
DataBind()
End If
' texte des boutons de navigation par semaine
sem.Text = txtsem.Text
btnNext.Text = "Semaine " & txtsem.Text + 1
btnPrevious.Text = "Semaine " & txtsem.Text - 1
End Sub
Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound
Try
' recupération des N° de commandes associés aux TC du datagrid
Dim lbl As Label = e.Item.Cells(5).FindControl("lblcmd")
Dim sqlcmd As New SqlCommand
sqlcmd.Connection = sqlconn
Dim drsqlcmd As SqlDataReader
If Not lbl Is Nothing Then
sqlcmd.CommandText = "select NUM_CMD from TAB_CMD where
CONT_CMD='" & DataBinder.Eval(e.Item.DataItem, "TC_CONT") & "' and
SESSION_CMD='" & se & "'"
sqlconn.Open()
drsqlcmd = sqlcmd.ExecuteReader
Do While drsqlcmd.Read
' affichage des N° de commande dans un controle
Label du Datagrid
lbl.Text = drsqlcmd(0) & "<br>" & lbl.Text
Loop
drsqlcmd.Close()
sqlconn.Close()
End If
' Calcul total colis/poids/volume par colonne
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If Not DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT") Is
System.DBNull.Value Then
sumcol +=
Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT"))
End If
If Not DataBinder.Eval(e.Item.DataItem, "PDS_CONT") Is
System.DBNull.Value Then
sumpds +=
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "PDS_CONT"))
End If
If Not DataBinder.Eval(e.Item.DataItem, "VOL_CONT") Is
System.DBNull.Value Then
sumvol +=
Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "VOL_CONT"))
End If
ElseIf e.Item.ItemType = ListItemType.Footer Then
e.Item.Cells(1).Text = "Total : "
e.Item.Cells(10).Text = String.Format("{0:g}", sumcol)
e.Item.Cells(11).Text = String.Format("{0:g}", sumpds)
e.Item.Cells(12).Text = String.Format("{0:g}", sumvol)
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
' appel de la fonction binddata avec nouvelle valeur de semaine
txtsem.Text = txtsem.Text + 1
sem.Text = txtsem.Text
binddata()
End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPrevious.Click
' appel de la fonction binddata avec nouvelle valeur de semaine
txtsem.Text = txtsem.Text - 1
sem.Text = txtsem.Text
binddata()
End Sub
Private Sub dg_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles dg.SelectedIndexChanged
' affichage des détails TC
err.Text = ""
binddata()
If dg.SelectedIndex <> -1 Then
' Mise en forme et appel du "sous datagrid"
Dim oDGItem As New DataGridItem(0, 0, ListItemType.Item)
Dim oCell As New TableCell
oCell.HorizontalAlign = HorizontalAlign.Right
oCell.ColumnSpan = dg.Columns.Count
oCell.BackColor = dg.SelectedItemStyle.BackColor
oDGItem.Cells.Add(oCell)
Dim id As String
id = ds.TAB_CONT(dg.SelectedIndex)("TC_CONT")
id = id & "_" & se
Dim oC As cmd2 = CType(Page.LoadControl("cmd2.ascx"), cmd2)
oC.IDc = id
oC.DataBind()
oCell.Controls.Add(oC)
dg.Controls(0).Controls.AddAt(dg.SelectedIndex + 3, oDGItem)
End If
End Sub
Private Sub dg_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand
' recup du paramètre pour le tri du datagrid
Dim txt As String
txt = e.SortExpression
t.Text = txt
binddata()
End Sub
En fait j'ai trouvé, il suffisant de passer le "EnableSessionState" de True à False.
"Mamaw" a écrit :
Bonjour, Lorsque je sors de n'importe quel traitement sur mon web form, je me retrouve avec une alert windows "stack overflow : line 0". J'ai vérifié mon code pour voir si je n'aavais rien de récursif et je n'ai rien trouvé. J'ai testé ma webform dans Netscape et je n'ai aucune erreur par contre sur un autre serveur en IE c'est la même erreur...c'est à ne rien comprendre. Quelqu'un pourrait-il m'aider ou jeter un coup d'oeil à mon code au cas ou... Merci.
code (datagrid avec tri, résulatas affichés par N° de semaine, sous datagrid dans controle utilisateur et total par colonnes) :
'déclaration des variables liées à l'identité client Dim se As String Dim cli As String
' déclaration variables pour sub displaytotal Dim sumcol As Integer = 0 Dim sumpds As Decimal = 0 Dim sumvol As Decimal = 0
#Region " Code généré par le Concepteur Web Form "
'Cet appel est requis par le Concepteur Web Form. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader Me.conn = New System.Data.SqlClient.SqlConnection Me.da = New System.Data.SqlClient.SqlDataAdapter Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.ds = New PLANNING.ds Me.cmdmodif = New System.Data.SqlClient.SqlCommand Me.sqlconn = New System.Data.SqlClient.SqlConnection CType(Me.ds, System.ComponentModel.ISupportInitialize).BeginInit() ' 'da ' Me.da.SelectCommand = Me.SqlSelectCommand1 Me.da.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "TAB_CONT", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ID_CONT", "ID_CONT"), New System.Data.Common.DataColumnMapping("DATE_CONT", "DATE_CONT"), New System.Data.Common.DataColumnMapping("HEURE_CONT", "HEURE_CONT"), New System.Data.Common.DataColumnMapping("TC_CONT", "TC_CONT"), New System.Data.Common.DataColumnMapping("MS_CONT", "MS_CONT"), New System.Data.Common.DataColumnMapping("PORT_CONT", "PORT_CONT"), New System.Data.Common.DataColumnMapping("DARR_CONT", "DARR_CONT"), New System.Data.Common.DataColumnMapping("ETD", "ETD"), New System.Data.Common.DataColumnMapping("eta", "eta"), New System.Data.Common.DataColumnMapping("NBCOL_CONT", "NBCOL_CONT"), New System.Data.Common.DataColumnMapping("PDS_CONT", "PDS_CONT"), New System.Data.Common.DataColumnMapping("VOL_CONT", "VOL_CONT"), New System.Data.Common.DataColumnMapping("PRIOR_CONT", "PRIOR_CONT"), New System.Data.Common.DataColumnMapping("COMMENT_CONT", "COMMENT_CONT")})}) ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY TC_CONT, NATURE_CONT" Me.SqlSelectCommand1.Connection = Me.conn Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@session", System.Data.SqlDbType.NVarChar, 10, "SESSION_CONT")) Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@sem", System.Data.SqlDbType.NVarChar, 10, "SEM_CONT")) ' 'ds ' Me.ds.DataSetName = "ds" Me.ds.Locale = New System.Globalization.CultureInfo("fr-FR") ' 'sqlconn ' Me.sqlconn.ConnectionString = CType(configurationAppSettings.GetValue("conn", GetType(System.String)), String) ' CType(Me.ds, System.ComponentModel.ISupportInitialize).EndInit()
End Sub Protected WithEvents conn As System.Data.SqlClient.SqlConnection Protected WithEvents da As System.Data.SqlClient.SqlDataAdapter Protected WithEvents ds As PLANNING.ds Protected WithEvents hl_visu As System.Web.UI.WebControls.HyperLink Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents cmdmodif As System.Data.SqlClient.SqlCommand Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator Protected WithEvents CompareValidator1 As System.Web.UI.WebControls.CompareValidator Protected WithEvents sqlconn As System.Data.SqlClient.SqlConnection Protected WithEvents sqlcmd1 As System.Data.SqlClient.SqlCommand Protected WithEvents cmdNext As New SqlCommand Protected WithEvents cmdPrevious As New SqlCommand Protected WithEvents conn1 As IBM.Data.DB2.DB2Connection Protected WithEvents conn3 As IBM.Data.DB2.DB2Connection Protected WithEvents conn2 As IBM.Data.DB2.DB2Connection
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load se = Request.QueryString("SE") cli = Request.QueryString("CLI") Dim aujourd As Date aujourd = Date.Now
If Not Page.IsPostBack Then ' appel de la fonction récup recup() ' appel de la fonction binddata avec txtsem = semaine en cours txtsem.Text = DatePart("ww", aujourd) binddata() End If End Sub
Sub binddata() da.SelectCommand.Parameters("@session").Value = se da.SelectCommand.Parameters("@sem").Value = txtsem.Text
' Tri par colonne If t.Text <> "" Then da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY " & t.Text & " " ' remplir le datagrid da.Fill(ds) DataBind() Else da.SelectCommand.CommandText = "SELECT * FROM TAB_CONT WHERE (TC_CONT IS NOT NULL) AND (ETA_CONT IS NOT NULL) AND (DATE_CONT IS NULL) AND (SESSION_CONT = @session) and SEM_CONT = @sem ORDER BY NATURE_CONT,TC_CONT " ' remplir le datagrid da.Fill(ds) DataBind() End If
' texte des boutons de navigation par semaine sem.Text = txtsem.Text btnNext.Text = "Semaine " & txtsem.Text + 1 btnPrevious.Text = "Semaine " & txtsem.Text - 1 End Sub
Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound Try ' recupération des N° de commandes associés aux TC du datagrid Dim lbl As Label = e.Item.Cells(5).FindControl("lblcmd") Dim sqlcmd As New SqlCommand sqlcmd.Connection = sqlconn Dim drsqlcmd As SqlDataReader If Not lbl Is Nothing Then sqlcmd.CommandText = "select NUM_CMD from TAB_CMD where CONT_CMD='" & DataBinder.Eval(e.Item.DataItem, "TC_CONT") & "' and SESSION_CMD='" & se & "'"
sqlconn.Open() drsqlcmd = sqlcmd.ExecuteReader Do While drsqlcmd.Read
' affichage des N° de commande dans un controle Label du Datagrid lbl.Text = drsqlcmd(0) & "<br>" & lbl.Text Loop drsqlcmd.Close() sqlconn.Close() End If
' Calcul total colis/poids/volume par colonne If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then If Not DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT") Is System.DBNull.Value Then sumcol += Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "NBCOL_CONT")) End If If Not DataBinder.Eval(e.Item.DataItem, "PDS_CONT") Is System.DBNull.Value Then sumpds += Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "PDS_CONT")) End If If Not DataBinder.Eval(e.Item.DataItem, "VOL_CONT") Is System.DBNull.Value Then sumvol += Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "VOL_CONT")) End If ElseIf e.Item.ItemType = ListItemType.Footer Then e.Item.Cells(1).Text = "Total : " e.Item.Cells(10).Text = String.Format("{0:g}", sumcol) e.Item.Cells(11).Text = String.Format("{0:g}", sumpds) e.Item.Cells(12).Text = String.Format("{0:g}", sumvol) End If Catch ex As Exception Response.Write(ex.Message) End Try End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click ' appel de la fonction binddata avec nouvelle valeur de semaine txtsem.Text = txtsem.Text + 1 sem.Text = txtsem.Text binddata() End Sub
Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click ' appel de la fonction binddata avec nouvelle valeur de semaine txtsem.Text = txtsem.Text - 1 sem.Text = txtsem.Text binddata() End Sub
Private Sub dg_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dg.SelectedIndexChanged ' affichage des détails TC err.Text = "" binddata() If dg.SelectedIndex <> -1 Then
' Mise en forme et appel du "sous datagrid" Dim oDGItem As New DataGridItem(0, 0, ListItemType.Item) Dim oCell As New TableCell oCell.HorizontalAlign = HorizontalAlign.Right oCell.ColumnSpan = dg.Columns.Count oCell.BackColor = dg.SelectedItemStyle.BackColor oDGItem.Cells.Add(oCell) Dim id As String id = ds.TAB_CONT(dg.SelectedIndex)("TC_CONT") id = id & "_" & se Dim oC As cmd2 = CType(Page.LoadControl("cmd2.ascx"), cmd2) oC.IDc = id oC.DataBind() oCell.Controls.Add(oC) dg.Controls(0).Controls.AddAt(dg.SelectedIndex + 3, oDGItem) End If End Sub
Private Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand ' recup du paramètre pour le tri du datagrid Dim txt As String txt = e.SortExpression t.Text = txt binddata() End Sub