ya i updated the stored procedure as given by u
i even tried by hardcoding the values in sp without passing the parameters still i get the error as below
System.Data.SqlClient.Sqlexception }: {"Incorrect syntax near '4'."}
error code :-2146232060
source : ".Net SqlClient Data Provider"
stack trace : " at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at
below is thhe sp
ALTER PROCEDURE [dbo].[usp_updaterate]
--@pcid int
--,@ppid int
--,@ptid int
--,@pqty int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Rate int
--SET @Rate = (select prate from [M_PRDT] where PID=@ppid)
IF EXISTS (SELECT cid FROM [trans] WHERE cid =36 and pid =47)--@pcid and pid=@ppid)
BEGIN
UPDATE [trans]
--set rate=@Rate
--WHERE cid =@pcid and pid=@ppid
set rate =6
where cid=36 and pid=47
END
Else
BEGIN
insert into [trans] (tid,cid,pid,qty,rate,[month],[year],amount,billno,frmdt,todt)
--select @ptid,@pcid,@ppid,@pqty,@Rate,0,0,00,'00','1/1/1900','1/1/1900'
select 215,36,47,0,6,0,0,00,'00','1/1/1900','1/1/1900'
END
END
if i execute it frm analyser as below i get it executed properly
exec usp_updaterate