Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
ALTER PROCEDURE [dbo].[K_FS_InsertMrpDetails]
   @date datetime,
   @feedtype varchar(50),
   @rateperkg float,
   @rateper50kg float,
   @updatedby varchar(50)
AS
BEGIN   

 if exists(select * from K_FS_GenerateDcno where date = @date)
 begin 
 select '1' as status
 end
 else
 begin

insert into K_FS_FeedMrpDetails([date],feedtype,rateperkg,rateper50kg,
updatedby,updatedon) values (@date,@feedtype,@rateperkg,@rateper50kg,
@updatedby,getdate())

select '2' as status

END


I am using Dynamic GridView in C#.net..I enteredd 9 Rows of one date
these 9 rows were updated by only one "DATE" if i enter same Date Then it shows "Date Rates Already Exists".. How can i Do this..Please Help Me..
Posted
Comments
joginder-banger 10-Jan-14 6:26am    
I think your date column is primary key.

1 solution

Hello ,
modify
@date datetime

to
@date date

as it is Datetime takes different date and time
thanks
 
Share this answer
 
Comments
Maciej Los 10-Jan-14 18:38pm    
SQL 2005 does not support date data type. See the documentation.
Animesh Datta 11-Jan-14 1:14am    
sorry for my wrong answer. then it is better if pass only date from front end . what is your opinion Sir Maciej Los ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900