R
Rodger
Hello all,
I am new to ASP.NET, but have been working with JavaScript, and Classic ASP.
I am just playing around with ASP.NET and I have a table that I would like
to edit the data but it is not working. I am not getting an error or
anything. When I click update the page reloads but the data does not
update.
Here is the code I have . . .
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Employees</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView2" runat="server"
DataSourceID="AccessDataSource1"
EmptyDataText="There are no data records to display."
style="font-size: 10pt; font-family: Tahoma, Arial; font-variant:
small-caps;" AllowPaging="True" AllowSorting="True"
BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
CellPadding="2" GridLines="None" AutoGenerateColumns="False"
AutoGenerateEditButton="True" ForeColor="Black" PageSize="100">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="EMP_LAST_NAME" HeaderText="LAST NAME"
SortExpression="EMP_LAST_NAME" />
<asp:BoundField DataField="EMP_FIRST_NAME" HeaderText="FIRST NAME"
SortExpression="EMP_FIRST_NAME" />
<asp:BoundField DataField="EMP_NUMBER" HeaderText="EMPLOYEE NUMBER"
SortExpression="EMP_NUMBER" />
<asp:BoundField DataField="EMP_COST_CENTER" HeaderText="COST CENTER"
SortExpression="EMP_COST_CENTER" />
<asp:BoundField DataField="EMP_PHONE" HeaderText="PHONE"
SortExpression="EMP_PHONE" />
<asp:BoundField DataField="EMP_EXT" HeaderText="EXT"
SortExpression="EMP_EXT" />
<asp:BoundField DataField="EMP_PAGER" HeaderText="PAGER"
SortExpression="EMP_PAGER" />
</Columns>
<FooterStyle BackColor="Tan" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="App_Data\EmployeeExtUpdate.mdb"
SelectCommand="SELECT EMP_LAST_NAME, EMP_FIRST_NAME, EMP_NUMBER,
EMP_COST_CENTER, EMP_VIRTUAL_EXT, EMP_PHONE, EMP_EXT, EMP_PAGER,
EMP_TERMINATED, EMP_DATE_ADDED, EMP_TIME_ADDED FROM EMPLOYEES ORDER BY
EMP_LAST_NAME"
UpdateCommand="UPDATE EMPLOYEES SET EMP_LAST_NAME = [EMP_LAST_NAME],
EMP_FIRST_NAME = [EMP_FIRST_NAME], EMP_NUMBER = [EMP_NUMBER],
EMP_COST_CENTER = [EMP_COST_CENTER], EMP_VIRTUAL_EXT = [EMP_VIRTUAL_EXT],
EMP_PHONE = [EMP_PHONE], EMP_EXT = [EMP_EXT], EMP_PAGER = [EMP_PAGER] WHERE
EMP_ID = [EMP_ID]">
</asp:AccessDataSource>
</form>
</body>
</html>
Thank you,
Rodger
I am new to ASP.NET, but have been working with JavaScript, and Classic ASP.
I am just playing around with ASP.NET and I have a table that I would like
to edit the data but it is not working. I am not getting an error or
anything. When I click update the page reloads but the data does not
update.
Here is the code I have . . .
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Employees</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView2" runat="server"
DataSourceID="AccessDataSource1"
EmptyDataText="There are no data records to display."
style="font-size: 10pt; font-family: Tahoma, Arial; font-variant:
small-caps;" AllowPaging="True" AllowSorting="True"
BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
CellPadding="2" GridLines="None" AutoGenerateColumns="False"
AutoGenerateEditButton="True" ForeColor="Black" PageSize="100">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="EMP_LAST_NAME" HeaderText="LAST NAME"
SortExpression="EMP_LAST_NAME" />
<asp:BoundField DataField="EMP_FIRST_NAME" HeaderText="FIRST NAME"
SortExpression="EMP_FIRST_NAME" />
<asp:BoundField DataField="EMP_NUMBER" HeaderText="EMPLOYEE NUMBER"
SortExpression="EMP_NUMBER" />
<asp:BoundField DataField="EMP_COST_CENTER" HeaderText="COST CENTER"
SortExpression="EMP_COST_CENTER" />
<asp:BoundField DataField="EMP_PHONE" HeaderText="PHONE"
SortExpression="EMP_PHONE" />
<asp:BoundField DataField="EMP_EXT" HeaderText="EXT"
SortExpression="EMP_EXT" />
<asp:BoundField DataField="EMP_PAGER" HeaderText="PAGER"
SortExpression="EMP_PAGER" />
</Columns>
<FooterStyle BackColor="Tan" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="App_Data\EmployeeExtUpdate.mdb"
SelectCommand="SELECT EMP_LAST_NAME, EMP_FIRST_NAME, EMP_NUMBER,
EMP_COST_CENTER, EMP_VIRTUAL_EXT, EMP_PHONE, EMP_EXT, EMP_PAGER,
EMP_TERMINATED, EMP_DATE_ADDED, EMP_TIME_ADDED FROM EMPLOYEES ORDER BY
EMP_LAST_NAME"
UpdateCommand="UPDATE EMPLOYEES SET EMP_LAST_NAME = [EMP_LAST_NAME],
EMP_FIRST_NAME = [EMP_FIRST_NAME], EMP_NUMBER = [EMP_NUMBER],
EMP_COST_CENTER = [EMP_COST_CENTER], EMP_VIRTUAL_EXT = [EMP_VIRTUAL_EXT],
EMP_PHONE = [EMP_PHONE], EMP_EXT = [EMP_EXT], EMP_PAGER = [EMP_PAGER] WHERE
EMP_ID = [EMP_ID]">
</asp:AccessDataSource>
</form>
</body>
</html>
Thank you,
Rodger