mrkcse
Starting Member
2 Posts |
Posted - 2008-09-06 : 03:09:43
|
Iam writing the following procedure for inserting phone call details into sqlserver.Iam using c# language on aspnet2.0 platform. In the debugging the code everything is fine and showing that record has inserted through procedure and cmd.ExecuteNonqQuery also returning value 1 each time. While accessing sqlserver phonecalls table it is not showing any records which are inserted.previosly this application was running fine and now also procedure running fine.dont know what the problem is.Here is the procedure...help me CREATE PROCEDURE [dbo].[Ph_Insert] @Extension char(10),@CallDate datetime, @CallTime Datetime,@Phone char(20), @Duration smallmoney, @Trunk int, @calls int, @CallType char(20),@cost smallmoneyASdeclare @type char(1)IF @CallType = 'Inc Call'SET @type = 'I'ELSE IF @CallType = 'Missed Call'SET @type = 'M'ELSE SET @type = 'O'select * from PhoneCalls where Extension = @Extension and CallDate = @CallDate and CallTime = @CallTimeIF @@rowcount = 0BEGIN INSERT INTO PhoneCalls( Extension, CallDate, CallTime, Phone, Duration, Trunk, calls, CallType, Flag, InsertedOn, DtandTime ) VALUES ( @Extension, @CallDate, @CallTime, @Phone, @Duration, @Trunk, @calls, @cost, @CallType, @type, Getdate(), convert(char(11),@CallDate,106) + ' ' + convert(char(10),@CallTime,108) ) END ELSE BEGIN UPDATE PhoneCalls SET Extension = @Extension, CallDate = @CallDate, CallTime = @CallTime, Phone = @Phone, Duration = @Duration, Trunk = @Trunk, calls = @calls, cost = @cost, CallType = @CallType, Flag = @type, UpdatedOn = GetDate(), DtandTime = convert(char(11),@CallDate,106) + ' ' + convert(char(10),@CallTime,108) WHERE Extension = @Extension and CallDate = @CallDate and CallTime = @CallTime END |
|