내이 같은 삭제 외모에 대한 코드 숨김 :저장 프로 시저가 작동하지 않습니까?
ALTER PROCEDURE maniputale
(
@mysid int = null,
@myproducts nvarchar(20) = null,
@mydescription varchar(50) = null,
@myprice int = null,
@mybrand varchar(20) = null,
@mymid int = null,
@action varchar = null
)
as
Begin
set NOCOUNT ON;
if @action = 'insert'
Begin
Insert into sub_catTbl(products,description,price,brand,mid)
values(@myproducts,@mydescription,@myprice,@mybrand,@mymid)
End
else if @action = 'select'
Begin
select * from sub_catTbl
End
else if @action = 'update'
Begin
update sub_catTbl set [email protected],description = @mydescription,price [email protected],[email protected],[email protected]
End
else if @action = 'delete'
Begin
delete from sub_catTbl where [email protected];
End
End
그러나 그것은 작동하지 않습니다 :
protected void delete(object sender, GridViewDeleteEventArgs e)
{
sc.connection();
//string st = "delete";
int id = Convert.ToInt32(((Label)(GridView1.Rows[e.RowIndex].FindControl("lblpro2"))).Text);
SqlCommand cmd = new SqlCommand("maniputale", sc.con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@action", "delete");
cmd.Parameters.AddWithValue("@mysid", 6);
//cmd.Parameters.Add("@action", SqlDbType.VarChar,50).Value= st;
//cmd.Parameters.Add("@mysid", SqlDbType.Int).Value = id;
cmd.ExecuteNonQuery();
}
그리고 저장 프로 시저입니다. 어떤 변화도 보이지 않으며 오류도 보이지 않습니다.
저장 프로 시저가 .cs 파일을 검사하기 위해 줄 바꿈을하는 것처럼 실행되는지 확인하는 방법이 있습니까?
전체 SP 소스를 제공하십시오. ** 문제가있는 ** 실행 ** 사례를 만드십시오. –
http://meta.stackexchange.com/questions/10647/how-do-i-write-a-good-title –
'@ action'은 어떤 문자입니까? 그것이'char (x)'또는'nchar (x)'이면'char'와'nchar'가'x'에 도달 할 때까지 내용을 공백으로 채우기 때문에 비교가 실패 할 수 있습니다. –