未提供过程或功能“期望"参数 [英] procedure or fuction 'expects parameter was not supplied
本文介绍了未提供过程或功能“期望"参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试按日期查看数据库中的电子邮件时,这里出现错误,这里是函数和存储过程
I have an error here when i try to view emails by by date in my database here is the function and stored procedure
#Region "View sent email by date"
Public Function view_sent_email(ByVal [date] As Date) As DataTable
Dim list As New List(Of csParameterList)
Dim dal As New csSQLDALVB
list.Add(New csParameterList("@e_send_date", SqlDbType.VarChar, [date].ToString()))
Return dal.executespreturndt("view_sent_email_by_date", list)
End Function
#End Region
ALTER proc [dbo].[view_sent_email_by_date](
@e_sent_date datetime)
as
if exists(select email_sender,email_subject,email_body,e_sent_date,EMAIL_SENT_TO from sent_Email
where convert(varchar(30),e_sent_date,106) = convert(varchar(30),@e_sent_date,106))
begin
select email_sender as 'Email Sender',email_subject as 'Subject',EMAIL_SENT_TO as 'Message Destination Email',email_body as 'Email Body',e_sent_date as 'Message Sent Time'from sent_Email
where convert(varchar(30),e_sent_date,106) = convert(varchar(30),@e_sent_date,106)
end;
else
begin
select'1'as'no sent email'
end;
错误提示
The error says
Procedure or function'view_email_by_date', expects parameter'@e_sent_date', which was not passed.
我正在搜索的日期不为null.
The date I am searching which is not null.
推荐答案
您要传递的参数中存在命名冲突
1.您的VB应用程序通过
There is a naming conflict in the parameter you are passing
1. Your VB applicaiton passes
@e_send_date
,但是您的存储过程期望
but your stored procedure expects
@e_sent_date
并且字母"send"(VB)与SP"sent"有所不同
将行
and there is a difference in the letter "send" (VB) compared to the SP "sent"
Change the line
list.Add(New csParameterList("@e_send_date", SqlDbType.VarChar, [date].ToString()))
更改为
list.Add(New csParameterList("@e_sent_date", SqlDbType.VarChar, [date].ToString()))
,它应该可以工作.
这篇关于未提供过程或功能“期望"参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文