Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help... DetailView won't update...

Thread Tools

Help... DetailView won't update...

Posts: n/a
The object of DetailView won't update the new record if the updatecommand has the "Where" Clause, but it will update all the rows in the table with the original old values.
, if there is a where clause, it won't update any rows.

May I know what would it happen....
I am really frustrated and no idea of it.....

The code of ASPX
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="listSeverInformation.aspx.cs" Inherits="listSeverInformation" Title="Server Information" Theme="SkinFile"%>
<asp:Content ID="Content" ContentPlaceHolderID="content" Runat="Server">
<div align="center">
Disk Information
<div align="center" style="padding-top: 20px; width: 100%">
<asp:GridView ID="gvDiskInformation" runat="server" Width="100%">

<div align="center" style="padding-top: 10px">
Server Information
<div align="center" style="padding-top: 10px; width: 100%" id="DIV1">
<aspetailsView ID="dvServerInformation" runat="server" BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" Height="50px" DataSourceID="sDS_ServerInformation"
Width="100%" AutoGenerateRows="False" AutoGenerateEditButton="True" DataKeyNames="server_id" OnItemUpdating="dvServerInformation_Updating" OnItemUpdated="dvServerInformation_Updated">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="Gainsboro" />
<asp:BoundField DataField="server_id" HeaderText="Server ID" SortExpression="server_id" Visible="true" ReadOnly="true" InsertVisible="False" />
<asp:BoundField DataField="serverip" HeaderText="Server IP" SortExpression="serverip" ReadOnly="true" InsertVisible="false"/>
<asp:BoundField DataField="location" HeaderText="Location" SortExpression="location" />
<asp:BoundField DataField="server_owner" HeaderText="Server Owner" SortExpression="server_owner" />
<asp:BoundField DataField="application" HeaderText="Applicaion on the Server" SortExpression="application" />
<asp:BoundField DataField="backup_type" HeaderText="Type of Backup" SortExpression="backup_type" />
<asp:BoundField DataField="remark" HeaderText="Remark" SortExpression="remark" />

<asp:SqlDataSource ID="sDS_ServerInformation" runat="server" ConnectionString="Data Source=MyServer\Test;Initial Catalog=Test;Persist Security Info=True;User ID=user;Password=password"
SelectCommand="SELECT serverDetail.server_id, serverDetail.location, serverDetail.server_owner, serverDetail.application, serverDetail.backup_type,, serverList.serverip, serverDetail.remark FROM serverDetail INNER JOIN serverList ON serverDetail.server_id = WHERE (serverList.serverip = @serverip)"
UpdateCommand="UPDATE serverDetail SET location = @location, server_owner = @server_owner, application = @application, backup_type = @backup_type, remark = @remark WHERE server_id = @server_id"

<asparameter Name="serverip" />
<asparameter Type="string" Name="server_id"/>
<asparameter Type="string" Name="location"/>
<asparameter Type="string" Name="server_owner" />
<asparameter Type="string" Name="application" />
<asparameter Type="string" Name="backup_type" />
<asparameter Type="string" Name="remark" />

Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formating a date field in ASP .Net 2.0 detailview =?Utf-8?B?Sm9obiBCYWlsZXk=?= ASP .Net 3 04-29-2010 09:40 AM
DetailView Data Update Error Henry Lee ASP .Net 0 03-02-2006 07:41 PM
detailview loses components after refresh Mike ASP .Net 0 01-31-2006 10:31 PM
DetailView =?Utf-8?B?QXJuZQ==?= ASP .Net 3 01-27-2006 01:28 PM
xpo objectdatasource gridview detailview Kha Tran ASP .Net 0 06-03-2005 09:22 AM