In this article, we will explore how to add, update, delete and select a record from sql server database using gridview control in a simple way.
I’m using visual studio 2008 and sql server 2008 for this sample.
Future installments will explore more advanced updating scenarios, such as customizing the Grid View's editing interface and programmatically setting the updated values. The UPDATE Table Name SET Column Name1 = @Parameter Value1 Column Name2 = @Parameter Value2 ...
Column Name N = @Parameter Value N WHERE Primary Key Column Name1 = @Primary Key Value To Update1 AND Primary Key Column Name2 = @Primary Key Value To Update2 AND ...
First, we need to prepare the database table and stored procedure for gridview operations such as insert, update & delete a records, here I’m using sql server 2008 for all database activities, for this sample I have created the customer table and stored procedure for all mentioned gridview operations.
NETLearn AJAXLearn Silverlight Learn Visual Studio Learn ADO. NETLearn Web Services Learn Controls Learn Biz Talk Learn Share Point Learn Mobile Learn SQLLearn SQL Reporting Learn Windows Forms Learn XMLLearn Crystal Reports Learn Far Point Learn Dev Express Examples ASP.
I'm pretty sure I need to change my Update Command of the sql Data Source that feeds my Grid View, and/or add code to my dropdown box's but I'm at a loss of how to do that.
Here is the template field of my Grid View: "UPDATE [Activity] SET [Name] = @Name, [Category] = @Category WHERE [Id] = @original_Id AND [Name] = @original_Name AND (([Category] = @original_Category) OR ([Category] IS NULL AND @original_Category IS NULL))"I've seen similar questions asked many times, but can't seem to find one that's exactly my problem.