Hi, i am new to ASP.NET. I have write a very simple code to try the
updating of the GridView but it is not updating the data. Below is the
simple code that i have use.
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="D:\Inetpub\wwwroot\MYOB_TEST\NET\Test
\Datagrid1\WebApplication1\WebApplication1\App_Dat a\kaimay.mdb"
DeleteCommand="DELETE from Office where
Office_Furniture_Data_ID = @Office_Furniture_Data_ID"
SelectCommand="SELECT [Office_Furniture_Data_ID],
[Office_Furniture_Data_desc], [Office_Furniture_Data_Image_Small] FROM
[Office]"
UpdateCommand="UPDATE Office SET Office_Furniture_Data_desc =
@Office_Furniture_Data_desc WHERE Office_Furniture_Data_ID =
@Office_Furniture_ID">
</asp:AccessDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True"
DataMember="DefaultView" DataSourceID="AccessDataSource1"
PageSize="2" DataKeyNames="Office_Furniture_Data_ID">
<Columns>
<asp:BoundField DataField="Office_Furniture_Data_ID"
HeaderText="Office_Furniture_Data_ID"
InsertVisible="False"
SortExpression="Office_Furniture_Data_ID" />
<asp:BoundField DataField="Office_Furniture_Data_desc"
HeaderText="Office_Furniture_Data_desc"
SortExpression="Office_Furniture_Data_desc" />
</Columns>
</asp:GridView>
</form>
</body>
</html>
IF under UpdateCommand, i try the below code, it will update. But if
from realtime updating, it will do nothing.
UpdateCommand="UPDATE Office SET Office_Furniture_Data_desc =
'testing' WHERE Office_Furniture_Data_ID = @Office_Furniture_ID
Thank You.