Advertisement

05.08.2008 at 10:13AM PDT, ID: 23386866 | Points: 125
[x]
Attachment Details

ASP.Net Update Command Not Working

Asked by drees727 in Programming for ASP.NET, .NET Framework 2.0

I'm using the AutoGenerateEditButton feature for a gridview and cannot get my update command to work.  I have DataKeyNames="ID" set on my gridview.  The delete command works fine.  If I hard code an ID (example:  WHERE [ID] = 4), the update command works fine.  It just doesn't seem to be recognizing the parameter @ID.  I'm using an Access database and ID is an autonumber field.  I've tried changing the paramter "type" from int32 to string.  I've tried setting OldValuesParameterFormatString="{0}" and ="original_{0}" .  I don't have any code in my code behind file.   Thanks for your help.

Code snippet:

        UpdateCommand="Update [Name] Set [EmpName] = @EmpName WHERE [ID] = @ID "
        DeleteCommand="Delete * FROM Name WHERE [id]= @ID"

             <UpdateParameters>
             <asp:Parameter Name="ID" Type=int32 />
             <asp:Parameter Name="EmpName" Type="String" />
            </UpdateParameters>Start Free Trial
[+][-]05.08.2008 at 10:27AM PDT, ID: 21526708

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 10:35AM PDT, ID: 21526776

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 10:40AM PDT, ID: 21526810

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 10:56AM PDT, ID: 21526943

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628