aspx probleme update gridview
je n'arrive pas a faire une commande update pouvez-vous m'aidez?
cose aspx.vb
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
Protected Sub conn()
Dim secret As String = "*******"
Grid_client1.DataSource = Nothing
DtSet.Clear()
SELECTI = "[***]"
cheminc = Server.MapPath("app_data/")
Connection.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & "data source=" & cheminc & "*****.mdb" & ";Persist Security Info=False;"
Connection.ConnectionString = Connection.ConnectionString & "Jet OLEDB:Database Password=" & secret
Sql = "select [CODE AGENT] FROM [feuille]"
Connection.Open()
'definition du DataAdapter
AdapTContact = New OleDbDataAdapter(Sql, Connection)
AdapTContact.Fill(DtSet, "feuille")
'remplissage de la liste avec le dataset
Matable = DtSet.Tables("feuille")
Dim dv As New DataView(Matable)
dv.Sort = "[CODE AGENT]"
Grid_client1.DataSource = dv
Grid_client1.DataBind()
' Connection.Close()
End Sub
Protected Sub Grid_client1_RowCancelingEdit(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs)
Grid_client1.EditIndex = -1 'set to no selection
Grid_client1.DataBind()
Call conn()
End Sub
Protected Sub Grid_client1_RowEditing1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles Grid_client1.RowEditing Grid_client1.EditIndex = e.NewEditIndex 'set to selected row
Grid_client1.DataBind()
Call conn()
End Sub
Protected Sub Grid_client1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles Grid_client1.RowUpdating
Grid_client1.EditIndex = -1 'set to no selection
Grid_client1.DataBind()
Call conn()
End Sub |
Voici le code HTLM
Code:
1 2 3 4 5 6 7 8 9
|
<asp:GridView ID="Grid_client1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="True" ShowFooter="True">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView> |
comment faire pour que Grid_client1_RowUpdating lance un update sur ma connection?
dois-je utiliser AdapTContact.Update(DtSet, "feuille")
ou une requete
sqlupdatecommand = "update FROM [feuille] WHERE au_id=@au_id;"
et où dois- je la placer?
Merci d'avance............