Edit/Update not saving data

Edit/Update not saving data

Postby tqdesign » Tue 02 May 2006 16:45

This is the code that I have. Whenever I edit then update, it does not save the data to the file. Can someone tell me what I am doing wrong?

Thanks,

<%@ Page Language="C#" %>


Updating Data Using GridView



DataSourceID="SqlDataSource1" AutoGenerateEditButton="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">













EnableCaching="True" SelectCommand="SELECT id, title, svalue FROM serving"
ProviderName="<%$ ConnectionStrings:north_siteConnectionString.ProviderName %>"
UpdateCommand="UPDATE serving SET title = ?, svalue = ? WHERE id = ?">









tqdesign
 
Posts: 1
Joined: Tue 02 May 2006 16:40

Postby Alexey » Wed 03 May 2006 07:53

Try to add
Code: Select all
DataKeyNames="id"

to the definition of GridView component:
Code: Select all
DataSourceID="SqlDataSource1" AutoGenerateEditButton="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" DataKeyNames="id">
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL