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. Advertising

  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. Advertising

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. Henry Lee

    DetailView Data Update Error

    Henry Lee, Mar 2, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    962
    Henry Lee
    Mar 2, 2006
  2. Remy
    Replies:
    0
    Views:
    526
  3. =?Utf-8?B?QmVydA==?=

    detailview update

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

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

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

    Update From DropDownList in DetailView

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

Share This Page