{"Message":"Cannot find column [AbDate].","StackTrace":" at System.Data.NameNode.Bind(DataTable table, List`1 list) 错误
{"Message":"Cannot find column [AbDate].","StackTrace":" at System.Data.NameNode.Bind(DataTable table, List`1 list) Error
我正在使用网络方法加载数据。我想检查此数据中是否存在特定数据。所以,我将它绑定到一个数据表。但是我在网络中发现错误
{"Message":"Cannot find column [AbDate].","StackTrace":" at
System.Data.NameNode.Bind(DataTable table, List1 list).
但是 AbDate
列存在。我确定,因为我使用 break point 检查值。
[WebMethod]
public static IList GetEvents(string Start, string End, double OS_Idno, double Gs_Id, string AccYear, double Sid)
{
DataSet ds = new DataSet();
DataTable dt1 = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter("My query", con);
sda.Fill(dt1);
ds.Tables.Add(dt1);
for (int i = 0; i < dt1.Rows.Count; i++)
{
DateTime AttDate = Convert.ToDateTime(dt1.Rows[i]["OSA_Dateofattendance"]);
DataRow[] Date1 = ds.Tables[0].Select("AbDate='" + AttDate + "' and Os_idno='" + OS_Idno + "'");
if (Date1.Count() == 0)
{
}
else
{
}
}
}
但是当我将代码更改为
DataRow[] Date1 = ds.Tables[0].Select("Os_idno='" + OS_Idno + "'");
对我有用。主要问题是问题不在我的本地,只在服务器上。我有一个完整的日历来显示这个结果。在控制台中,我发现错误
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
请帮忙,我不知道该怎么做
我认为您必须更改您的查询,例如:
SELECT AbDate AS AD …
并在过滤中使用 AD
而不是 AbDate
像这样:
DataRow[] Date1 = ds.Tables[0].Select("AD='" + AttDate + "' and Os_idno='" + OS_Idno + "'");
我正在使用网络方法加载数据。我想检查此数据中是否存在特定数据。所以,我将它绑定到一个数据表。但是我在网络中发现错误
{"Message":"Cannot find column [AbDate].","StackTrace":" at System.Data.NameNode.Bind(DataTable table, List1 list).
但是 AbDate
列存在。我确定,因为我使用 break point 检查值。
[WebMethod]
public static IList GetEvents(string Start, string End, double OS_Idno, double Gs_Id, string AccYear, double Sid)
{
DataSet ds = new DataSet();
DataTable dt1 = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter("My query", con);
sda.Fill(dt1);
ds.Tables.Add(dt1);
for (int i = 0; i < dt1.Rows.Count; i++)
{
DateTime AttDate = Convert.ToDateTime(dt1.Rows[i]["OSA_Dateofattendance"]);
DataRow[] Date1 = ds.Tables[0].Select("AbDate='" + AttDate + "' and Os_idno='" + OS_Idno + "'");
if (Date1.Count() == 0)
{
}
else
{
}
}
}
但是当我将代码更改为
DataRow[] Date1 = ds.Tables[0].Select("Os_idno='" + OS_Idno + "'");
对我有用。主要问题是问题不在我的本地,只在服务器上。我有一个完整的日历来显示这个结果。在控制台中,我发现错误
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
请帮忙,我不知道该怎么做
我认为您必须更改您的查询,例如:
SELECT AbDate AS AD …
并在过滤中使用 AD
而不是 AbDate
像这样:
DataRow[] Date1 = ds.Tables[0].Select("AD='" + AttDate + "' and Os_idno='" + OS_Idno + "'");