本文介绍了数据库连接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为我的报表创建了存储过程。
I have created a stored procedure for my report..
create Procedure [dbo].[sp_Score_Grade]
@Month int,
@Year int,
@Log_User varchar(30)
AS
(
SELECT Log_User, Count = COUNT(Det_Score), Score = SUM(Det_Score)
FROM MEMBER M,DETAILS D
WHERE D.Emp_Id = M.Emp_Id AND
Log_User like '@Log_User'
AND Month(Sched_Start) = '@Month'
AND Year(Sched_Start) = '@Year'
GROUP BY Log_User
)
当Crystal Report对话框出现要求参数时,我检查所有的值为null。但在我进入下一步之前。下面显示的错误。
And when the Crystal Report dialog box appear asking for parameters, I check all the values to null. But before i proceed to the next step. The error below displayed.
Database Connector Error:
Source: Microsoft OLE DB Provider for SQL Server
Description: Conversion failed when converting the varchar value '@Month' to data type int
SQL State: 22018
Native Error: 245[Database Vendor Code: 245]
我希望有人在这里可以解释为什么我得到这个错误,我将如何做...
Im使用MS SQL Server 2005和VS2010的Crystal Report ..
I am hoping that someone here can explain to me why I get this error and how will I do...Im using MS SQL Server 2005 and Crystal Report for VS2010..
提前感谢。 :D
推荐答案
您的参数名称在查询中被分隔,因此SQL Server将它们视为字符串。尝试
Your parameter names are delimited in the query, so SQL Server is treating them as literal strings. Try
Log_User like @Log_User
AND Month(Sched_Start) = @Month
AND Year(Sched_Start) = @Year
这篇关于数据库连接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!