Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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

Code:
 <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"/>
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <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" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <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');"/>
                    </ItemTemplate>
                </asp:TemplateField>
                <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" />
Code:
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"
        Try
            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))
    
            con1.Open()
            cmd1.ExecuteNonQuery()
        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
        con1.Close()
        GridView1.EditIndex = -1
        BindGridView()
    End Sub

This program:

edit select delete id etc.


(outside under ther gridview)

textbox1
textbox2

addbutton cancelbutton savebutton


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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:58 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.