Need help with Update and Delete in DetailView

N

Net

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

Net

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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top