Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 9th, 2010, 10:30 PM
Authorized User
Join Date: Jun 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default vwd 2008 express with access - rowupdating

 <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" DataKeyNames="id"  
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" GridLines="Vertical" >
            <RowStyle BackColor="#EEEEEE" ForeColor="Black"/>
                <asp:TemplateField ShowHeader="False">
                        <asp:Button ID="Button1" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update" />
                        &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel" />
                        <asp:Button ID="Button1" runat="server" CausesValidation="False" 
                            CommandName="Edit" Text="Edit" />
                        &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False" 
                            CommandName="Select" Text="Select" />
                        &nbsp;<asp:Button ID="Button3" runat="server" CausesValidation="False" 
                            CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure');"/>
                <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                    ReadOnly="True" SortExpression="id" Visible="False" />
                <asp:BoundField DataField="sysaccount" HeaderText="sysaccount" 
                    SortExpression="sysaccount" />
                <asp:BoundField DataField="syspw" HeaderText="syspw" SortExpression="syspw" />
                <asp:BoundField DataField="log" HeaderText="log" SortExpression="log" />
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
        Dim sqlupdate As String
        Dim con1 As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\user\Desktop\honor.mdb")
        sqlupdate = "UPDATE sysdep SET sysaccount= @sysaccount, syspw= @syspw WHERE id= @id"
            Dim cmd1 As New OleDbCommand(sqlupdate, con1)
            Dim id As String = (GridView1.Rows(e.RowIndex).Cells(0).ToString)
            Dim account As String = (GridView1.Rows(e.RowIndex).Cells(1).ToString)
            Dim pw As String = (GridView1.Rows(e.RowIndex).Cells(2).ToString)

            cmd1.Parameters.Add(New OleDbParameter("@sysaccount", account))
            cmd1.Parameters.Add(New OleDbParameter("@syspw", pw))
            cmd1.Parameters.Add(New OleDbParameter("@id", id))
        Catch ex As OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "web")
        Catch ex As InvalidOperationException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "web")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "web")
        End Try
        GridView1.EditIndex = -1
    End Sub

This program:

edit select delete id etc.

(outside under ther gridview)


addbutton cancelbutton savebutton

All buttons working, except the rowupdate, no error message, just won't get update.

Last edited by Grace; June 9th, 2010 at 10:37 PM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anyone got this working with VWDE 2008 / SQL Express 2008? john77 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 4 January 18th, 2010 01:16 PM
VWD express install paulabethjax BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 January 8th, 2007 03:45 PM
VWD 2.0 Express compatible msch-prv BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 July 6th, 2006 06:21 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.