Best Strategy-Method to Edit-Delete records via a gridview

  • we have a gridview named gridResults that we want to show the matched item

    of a traveler ,

    with specifying its flight date , ticket number , & name ,

    Now I want to give the possibility to Edit or Delete the Traveler ,

    How many methods do we have to achieve this ,

    How to show the info of that traveler in the result's grid ,

    I used a sproc as follows :

    CREATE PROCEDURE [dbo].[SearchForPassenger]

    (

    @name char(50) ,

    @flightDate char(15) ,

    @ticketNo char(10)

    )

    AS

    --

    SET NOCOUNT ON;

    --

    -- Condition

    SELECT [passenger-id] FROM passengers ppp

    INNER JOIN [passenger-flylist] ppff ON ppp.[passenger-id] = ppff.[passenger-id]

    INNER JOIN flylist fff ON ppff.[flylist-id] = ppff.[flylist-id]

    WHERE ppp.[name] = @name AND

    fff.[start-from] = @flightDate AND

    ppp.[ticket-number] = @ticketNo

    I think this shows the structure ,

    Getting the passenger ID and then delete it , Update it ,

    Setting Parameters :

    ticketNumber = Int32.Parse(Request.QueryString["T"]);

    pName = Request.QueryString["N"] ;

    date = Request.QueryString["D"];

    [/quote]

    what is the best method-strategy to edit-delete rows in this case ?

    for example do I need any special code for deleting the row , or setting a simple delete button with allow deleting and allow editing is enough ?

    Does the gridview keep the id of the traveler or I need to execute another sproc ?

    ( I want to find easiest way )

  • There are a number of ways to go about this, but this is the wrong forum to be asking this specific question in. By looking at your code, I can only guess that you are doing ASP.NET which would make:

    http://forums.asp.net

    the most likely best place to ask this question. You can add a button column to the grid for Edit and a button column to the grid for Delete and handle the CellClick event and check the name of the column that was clicked, then use the EventArgs to get the row index and populate your edit box or perform the delete on postback. If you do it in a AJAX ContentPanel, you can do it without having the form perform a full postback.

    However you go about it, it doesn't have anything to do with SQLCLR or CLR integration inside SQL Server, which is the use of .NET to create extended procedures, functions, types, and aggregates inside of SQL Server for use in TSQL coding.

    Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
    My Blog | Twitter | MVP Profile
    Training | Consulting | Become a SQLskills Insider
    Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]

  • Thanks for your participation and advice ,

    I think you are right .

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply