ALTER PROCEDURE [dbo].[artdetails1] ( @artdetailId int, @artDescription varchar(50), @artShortdesc varchar(50), @artValidity varchar(50), @artStatus varchar(50), @StatementType varchar(50) ) AS BEGIN BEGIN IF @StatementType = 'Insert' BEGIN insert into artdetails(artDescription,artShortdesc,artValidity,artStatus) values(@artDescription,@artShortdesc,@artValidity,@artStatus) END IF @StatementType = 'Select' BEGIN select * from artdetails END IF @StatementType = 'Update' BEGIN update artdetails SET artDescription=@artDescription,artShortdesc=@artShortdesc, artValidity=@artValidity,artStatus=@artStatus where artdetailId= @artdetailId END else IF @StatementType = 'Delete' BEGIN Update artist SET @artStatus= 'not available'; END end end
cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "artdetails1"; cmd.Parameters.Add(new SqlParameter("@parametername", SqlDbType.VarChar, 50)); cmd.Parameters["@StatementType "].Value = "Insert";//query type
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)