我的项目中出现异常错误 [英] Exception Error in my project
问题描述
当我调试源代码时,出现以下异常:
数据绑定:System.Data.DataRowView不包含属性.
我绑定了一个名为weekDate的变量.
when i am debugging my source code i am getting exception as:
Databinding: System.Data.DataRowView does not contain a property.
i binded one variable named weekDate.
<asp:Label ID="label" Text='<%#Eval("WeekDate")%>' runat="server">
此时在设计页面中我遇到了错误.查询的表中没有此列名,我只是将其称为weekDate.
提前谢谢!
编辑(添加代码)================
In the design page at this point i am getting error.This column name is not there in table in the query i just called it as weekDate.
Thanks in advance!
EDIT (adding code) ================
SELECT TimeSheetEntry.ProjectId
,TaskId
,Saturday
,Sunday
,Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,WorkingHoursPerweek
,StatusId
,TaskActivityId
,ActivityTypeId
,SubmitionDate
,ApprovalDate
,convert(varchar(50),weekStartDate,101) + ' - ' + convert(varchar(50),WeekEndDate,101) as WeekDate
FROM TimeSheetEntry, Projects
WHERE EmployeeID=@empid and ApprovalDate is null
AND Projects.ProjectId=TimeSheetEntry.ProjectId
ORDER BY weekStartDate, ProjectName asc
推荐答案
您没有在问题中包含代码.请无任何原因查看此链接
异常- DataBinding:"System.Data.DataRowView"不包含名称为"x"的属性 [
You didn''t include your code in your question. Please see this link for no of reasons for this error
Exception - DataBinding: ''System.Data.DataRowView'' does not contain a property with the name ''x''[^]
如果要从多个表中提取数据,则应确实指定要从中提取列的WHICH表:
If you''re pulling data from multiple tables, you really should specify WHICH table the column is being pulled from:
SELECT t.ProjectId
,p.TaskId
,p.Saturday
,p.Sunday
,p.Monday
,p.Tuesday
,p.Wednesday
,p.Thursday
,p.Friday
,p.WorkingHoursPerweek
,p.StatusId
,p.TaskActivityId
,p.ActivityTypeId
,p.SubmitionDate
,p.ApprovalDate
,convert(varchar(50),p.weekStartDate,101) + ' - ' + convert(varchar(50),p.WeekEndDate,101) as WeekDate
FROM TimeSheetEntry t, Projects p
WHERE t.EmployeeID = @empid
AND t.ApprovalDate is null
AND p.ProjectId = t.ProjectId
ORDER BY p.weekStartDate, p.ProjectName asc
请记住,我只是在猜测各个列位于哪个表中,因此您可能需要对其进行调整.我认为您可能通常还需要重构查询(您执行的连接类型正确吗?).
Keep in mind that I''m just guessing at which table the various columns are in, so you''ll probably need to tweak this. I think you may also need to refactor your query in general (are you doing the correct kind of join?).
这篇关于我的项目中出现异常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!