Petit souci d'Update sur un GridView
Bonjour tout le monde.
J'ai un GridView récalcitrant qui ne veut pas faire le Update que je lui demande.
J'ai beau relire mon code, je ne vois pas ce qui le perturbe.
Pourriez vous, avec un oeil neuf, regarder pourquoi ce brave Monsieur ne veut pas faire gentimement ce que je lui demande gentiment (avant que je ne décide de le priver dessert !)
Donc, côté HTML j'ai mis ça :
Code:
1 2 3
|
<asp:SqlDataSource ID="sdsListeBloc" runat="server" ConnectionString="<%$ ConnectionStrings:DataCon %>"></asp:SqlDataSource>
<asp:GridView ID="gvListeBloc" runat="server" DataSourceID="sdsListeBloc" DataKeyNames="IdBlocGoogle"></asp:GridView> |
Et dans le code Behind j'ai ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
With gvListeBloc
.AutoGenerateDeleteButton = True
.AutoGenerateEditButton = True
End With
ChargerGV()
End Sub
Sub ChargerGV()
Dim bfNom, bfScript As New BoundField
With bfNom
.DataField = "NomBlocGoogle"
.HeaderText = "Nom Bloc"
End With
With bfScript
.DataField = "ScriptBlocGoogle"
.HeaderText = "Script"
End With
With sdsListeBloc
.SelectCommandType = SqlDataSourceCommandType.Text
.InsertCommandType = SqlDataSourceCommandType.Text
.UpdateCommandType = SqlDataSourceCommandType.Text
.DeleteCommandType = SqlDataSourceCommandType.Text
.SelectCommand = "EXEC dbo.VALHALLA_AnnonceGoogle_ListeScript '" & Session("SES_Appli") & "'"
.DeleteCommand = "DELETE CORE_BlocGoogle WHERE IdBlocGoogle = @IdBlocGoogle"
.UpdateCommand = "UPDATE CORE_BlocGoogle SET NomBlocGoogle = @NomGBlocGoogle, ScriptBlocGoogle = @ScriptNomGoogle WHERE IdBlocGoogle = @IdBlocGoogle"
.InsertCommand = "INSERT INTO CORE_BlocGoogle ([ApplicationId],[NomBlocGoogle],[ScriptBlocGoogle]) VALUES ('" & Session("SES_Appli") & "','','')"
End With
With gvListeBloc
.AutoGenerateColumns = False
With .Columns
.Add(bfNom)
.Add(bfScript)
End With
.DataBind()
End With
End Sub |
Impossible de voir pourquoi ça ne fonctionne pas.
Et en plus pas de message d'erreur, juste il fait pas le Update, les données dans la table ne bougent pas.
Vous voyez ?