Hi,
When I'm trying insert or update using stored procedure ,then throws error as "Procedure or function has too many arguments specified."
when I test in SQL server records are getting executed,but when comes to aspx page cannot achieve ,where I'm missing the parameters.
Please have a look into my code :
<telerik:RadScheduler ID="RadScheduler1" runat="server" OverflowBehavior="Expand"
SelectedView="MonthView" TimeZoneOffset="00:00:00" DataSourceID="AppointmentsDataSource" Height="100%"
DataKeyField="ScheduleId" DataSubjectField="ScheduleTime" DataStartField="ScheduleDate" DataEndField="enddate"
CustomAttributeNames="ScheduleTime,Customer,ScheduleId,servicecode" StartInsertingInAdvancedForm="false" StartEditingInAdvancedForm="false"
OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" Visible="false" EnableAdvancedForm="false" OnClientFormCreated="OnClientFormCreated"><DayView UserSelectable="false" /><WeekView UserSelectable="false" /><TimelineView UserSelectable="false" /><MonthView VisibleAppointmentsPerDay="10" AdaptiveRowHeight="false" MinimumRowHeight="7"/> <AdvancedForm Modal="true"></AdvancedForm><AppointmentTemplate><b><%# Eval("ScheduleTime").ToString()=="0.0"?"":Eval("ScheduleTime") %></b><b><%# Eval("Customer") %></b></AppointmentTemplate><TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings><AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings></telerik:RadScheduler><asp:SqlDataSource ID="AppointmentsDataSource" runat="server"
ProviderName="System.Data.SqlClient"
SelectCommand=" SELECT(select ServiceGroupCd from wcms_vCaseServiceList where CaseServiceRefNo=X.CaseServiceRefNo) ServiceGroupCd ,(select EntityName from wcms_vCaseServiceList where CaseServiceRefNo=X.CaseServiceRefNo) Customer,ScheduleDate as EndDate,* FROM [XAPPNewScheduling] X where UserId=@id union all select 'Leave' ServiceGroupCd,LeaveType +'(' + cast(CAST( WorkingDays AS decimal(10,1)) as varchar(10))+' days'+')' Customer,ToDateTime as EndDate,''ScheduleId,'' CaseServiceRefNo,FromDateTime ScheduleDate,0 as ScheduleTime,'' UserId from [dbo].[wcms_vLeave] L where L.StateId not in (3198,3103,3104) and L.EntityId=@id "
InsertCommandType="StoredProcedure" InsertCommand="Xapp_spDuplicateRecords"
UpdateCommandType="StoredProcedure" UpdateCommand="Xapp_spDuplicateRecords"
DeleteCommand="DELETE FROM [XAPPNewScheduling] WHERE [ScheduleId] = @ScheduleId"> <SelectParameters><asp:QueryStringParameter Name="id" QueryStringField="id" Direction="Input" Type="Int32"></asp:QueryStringParameter></SelectParameters><DeleteParameters><asp:Parameter Name="ScheduleId" Type="Int32"></asp:Parameter></DeleteParameters><UpdateParameters><asp:QueryStringParameter Direction="Input" Name="CaseServiceRefNo" QueryStringField="CaseServiceRefNo" Type="String"></asp:QueryStringParameter><asp:Parameter Direction="Input" Name="ScheduleDate" Type="DateTime"></asp:Parameter><asp:Parameter Direction="InputOutput" Name="ScheduleTime" Type="Decimal"></asp:Parameter><asp:QueryStringParameter Direction="Input" Name="UserId" QueryStringField="id" Type="Int32"></asp:QueryStringParameter><asp:Parameter Direction="Input" Name="ScheduleId" Type="Int32"></asp:Parameter></UpdateParameters><InsertParameters><asp:QueryStringParameter Direction="Input" Name="CaseServiceRefNo" QueryStringField="CaseServiceRefNo" Type="String"></asp:QueryStringParameter><asp:Parameter Direction="Input" Name="ScheduleDate" Type="DateTime"></asp:Parameter><asp:Parameter Direction="InputOutput" Name="ScheduleTime" Type="Decimal"></asp:Parameter><asp:QueryStringParameter Direction="Input" Name="UserId" QueryStringField="id" Type="Int32"></asp:QueryStringParameter><asp:Parameter Direction="InputOutput" Name="ScheduleId" Type="Int32" DefaultValue="0"></asp:Parameter></InsertParameters></asp:SqlDataSource>Here is the Stored Procedure:
alter PROCEDURE Xapp_spDuplicateRecords
(
@CaseServiceRefNo varchar(500),
@ScheduleDate datetime,
@ScheduleTime decimal(18,2),
@id int,
@ScheduleId int
)
AS
BEGIN
IF EXISTS (SELECT * FROM dbo.XAPPNewScheduling WHERE CaseServiceRefno=@CaseServiceRefNo and ScheduleDate=@ScheduleDate and UserId =@id)
BEGIN
print 'update'
print @ScheduleId
UPDATE dbo.XAPPNewScheduling SET CaseServiceRefNo=@CaseServiceRefNo,ScheduleDate=@ScheduleDate,ScheduleTime=ScheduleTime+@ScheduleTime,UserId =@id WHERE ScheduleId =@ScheduleId
END
else
BEGIN
print 'insert'
INSERT INTO dbo.XAPPNewScheduling(CaseServiceRefNo,ScheduleDate,ScheduleTime,UserId) VALUES (@CaseServiceRefNo ,@ScheduleDate,@ScheduleTime,@id)
END
END
Can anyone Please help me to solve this issue.
Looking forward for your replies.Thanks in advance!!!