Need help with Update and Delete in DetailView

Discussion in 'ASP .Net Web Controls' started by Net, Jun 2, 2006.

  1. Net

    Net Guest

    Hi,

    I need help with Update and Delete in DetailView

    Here is an ex:
    DeleteCommand="Delete From [Test]
    Where [Col_ID]= @original_Col_ID">

    I get Exception Details: System.Data.SqlClient.SqlException: Must declare
    the scalar variable "@original_Col_ID"
    I get the dame Exception for the UpdateCommand

    Col_ID is an identity column in SQL Server 2005.
    How to update and delete the current record that the user selected from the
    DetailView?

    Is this inline way the proper way to execute SQL statement. Or better way
    to use stored procedure. If so, can an example be provided.

    Thanks in advance.
     
    Net, Jun 2, 2006
    #1
    1. Advertisements

  2. Net

    Net Guest

    I had to use DataKeyNames and then change:
    DeleteCommand="Delete From [Test]
    Where [Col_ID]= @Col_ID">
    and Delete and Update worked.

    I am still looking how to call stored procedure.

    Thanks in advance,


    "Net" wrote:

    > Hi,
    >
    > I need help with Update and Delete in DetailView
    >
    > Here is an ex:
    > DeleteCommand="Delete From [Test]
    > Where [Col_ID]= @original_Col_ID">
    >
    > I get Exception Details: System.Data.SqlClient.SqlException: Must declare
    > the scalar variable "@original_Col_ID"
    > I get the dame Exception for the UpdateCommand
    >
    > Col_ID is an identity column in SQL Server 2005.
    > How to update and delete the current record that the user selected from the
    > DetailView?
    >
    > Is this inline way the proper way to execute SQL statement. Or better way
    > to use stored procedure. If so, can an example be provided.
    >
    > Thanks in advance.
    >
     
    Net, Jun 2, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shapper
    Replies:
    3
    Views:
    708
    Scott Allen
    Jul 9, 2005
  2. Henry Lee

    DetailView Data Update Error

    Henry Lee, Mar 2, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,061
    Henry Lee
    Mar 2, 2006
  3. HeroOfSpielburg
    Replies:
    1
    Views:
    572
    Alf P. Steinbach
    Aug 6, 2003
  4. Remy
    Replies:
    0
    Views:
    580
  5. 0to60
    Replies:
    4
    Views:
    460
    Jerry Coffin
    Dec 19, 2003
  6. =?Utf-8?B?QmVydA==?=

    detailview update

    =?Utf-8?B?QmVydA==?=, Jan 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    =?Utf-8?B?QmVydA==?=
    Jan 5, 2007
  7. LamSoft

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

    LamSoft, Jul 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    630
    LamSoft
    Jul 5, 2007
  8. Randy

    Update From DropDownList in DetailView

    Randy, May 5, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    254
    Randy
    May 7, 2006
Loading...