在带有 ASP.NET 4 的 Visual Studio 2010 中,我试图将几个表连接在一起,以将结果放在带有 sqldatasource 的网格视图和详细信息视图中。在 sqldatasource 向导中,我选择指定自定义 SQL 语句或存储过程,然后在 Query Builder 中定义复杂查询(例如 JOIN),我尝试生成 SQL 语句以将问题表与来自其他表的特定列连接起来。但是当我尝试测试查询时,我收到一条错误消息,上面写着“无法在 varchar 上调用方法”。我是 sql 语句的新手,所以请您告知语句有什么问题。下面是生成的sql语句
SELECT Problem.ProblemID, Problem.CustomerID, Problem.Summary,
Problem.DateLogged, Problem.DateUpdated, Status.Status, Priority.Priority,
Technician.Name, Technician.Surname, [Skill Group].[Skill Group],
HelpdeskOperator.Name AS Expr1,
HelpdeskOperator.Surname AS Expr2, Problem.NoteID, Problem.ResolutionID
FROM Problem
INNER JOIN Status ON Problem.StatusID = Status.Status.StatusID
INNER JOIN HelpdeskOperator ON
Problem.HelpdeskID = HelpdeskOperator.HelpdeskID AND Status.StatusID = HelpdeskOperator.StatusID
INNER JOIN Priority ON Problem.PriorityID = Priority.PriorityID
INNER JOIN [Skill Group] ON Problem.SkillGroupID = [Skill Group].SkillGroupID
INNER JOIN Technician ON Problem.ProblemID = Technician.ProblemID
AND Status.StatusID = Technician.StatusID AND
Priority.PriorityID = Technician.PriorityID
AND [Skill Group].SkillGroupID = Technician.SkillGroupID
先感谢您