Я получаю эту ошибку, я работаю с Visual Studio 2016 и Microsoft Management Studio SQL Server 2016.Процедура или функция 'procMakeTimeSlot' ожидает параметр '@userFriendlyErorrMessage', который не поставлялся
процедуры или Функция 'procMakeTimeSlot' ожидает параметр '@userFriendlyErorrMessage', который не был предоставлен.
и
command.ExecuteNonQuery(); //.Net says anything not select operation is a non query
create proc procMakeTimeSlot
(
@appointmentId int,
@appointmentSlotId int,
@userFriendlyErorrMessage varchar(100) output
)
as
begin
declare @successfulInsert bit;
begin try
insert into ApptTimePeriod
(AppointmentId, AppointmentSlotId)
values
(@appointmentId, @appointmentSlotId)
set @userFriendlyErorrMessage = 'Successful';
set @successfulInsert = 1;
end try
begin catch
--primary key error
if (ERROR_MESSAGE() like'%pkApptTimePeriod%')
set @userFriendlyErorrMessage = 'Appointment has already been added to the time slot'
if(ERROR_MESSAGE() like
'%fkAppointmentTimePeriodToAppointmentSlot%')
set @userFriendlyErorrMessage = 'Invalid Time Slot';
if(ERROR_MESSAGE() like '%fkAppointmentTimePeriodToAppointment%')
set @userFriendlyErorrMessage = 'Invalid Appointment';
if(ERROR_MESSAGE() like '%chSlotsLeft%')
set @userFriendlyErorrMessage = 'No time Slots Available';
set @successfulInsert = 0;
end catch
return @successfulInsert;
end
/*
declare @userFriendlyErorrMessage varchar(100);
execute procMakeTimeSlot
@appointmentId = 10005,
@appointmentSlotId = 100,
@userFriendlyErorrMessage = @userFriendlyErorrMessage output;
print @userFriendlyErorrMessage;
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="FindServiceAvailability.aspx.cs" Inherits="VehicleServiceWebAppMcConnell.FindServiceAvailability" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<asp:Calendar ID ="calStartDate" Caption ="Choose start date (optional)" runat="server" />
<asp:Calendar ID ="calEndDate" Caption ="Choose end date (optional)" runat="server" />
<asp:Button ID ="btnFindServiceAvailability" Text ="Find Service Availability" runat ="server" OnClick="btnFindServiceAvailability_Click" />
<asp:GridView ID ="gvAvailableServiceTimes" Caption = "Available Service Dates and Times" runat ="server" AutoGenerateColumns ="False" EmptyDataText = "No availability for requested date/time" >
<Columns>
<asp:TemplateField HeaderText ="Select Date and Times">
<ItemTemplate>
<asp:CheckBox ID ="cbSelectedDateTime" runat = "server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField ="AppointmentSlotId" HeaderText ="Appointment Slot ID" />
<asp:BoundField DataField ="ApptDate" DataFormatString = "{0:d}" HeaderText ="Available Date" />
<asp:BoundField DataField ="ApptTime" HeaderText ="Start Time" />
</Columns>
</asp:GridView>
<asp:Button ID ="btnMakeAppointment" Text ="Make Appointment" runat ="server" OnClick="btnMakeAppointment_Click" />
<asp:Label ID ="lblResultMessage" runat ="server" />
</asp:Content>
Где ваш .Net-код? Что вы передаете для @userFriendlyErorrMessage? – Seano666
Просто добавил, что я знаю, что AppointmentSlotId правильно написано в моей процедуре в студии управления Microsoft (SQL) для procMakeTimeSlot – Student
Дайте мне знать, если вам нужно увидеть мой визуальный код студии. Или даже полное решение, я уверен, что его очень маленькая ошибка, один из моих друзей сказал, что мне нужно объявить userfriendlyerrormessage как varchar, но я уже это сделал? возможно, мне нужно сделать это в визуальной студии? – Student