本帖最后由 sz_xd 于 2020-11-26 00:24 编辑
发现 活字格 6.102版在对内表查询记录时,当发现没找到记录时,会提示出错,程序中止,这不应该产生这错误,以前当没找到时,是返回data.Count=0 的值,具体引用文件参考,及 出错提示的内容,我摘录以下:
GetTableData 方法 - 活字格6.0帮助手册 - 葡萄城产品文档中心 (grapecity.com.cn)
https://help.grapecity.com.cn/pa ... ion?pageId=46172495
public class SampleApi : ForguncyApi
{
[Post]
public void GetTableData()
{
//要获取的行的字段名及值
ColumnValuePair valuepair = new ColumnValuePair();
valuepair.ColumnName = "ID";
valuepair.Value = 1;
//使用GetTableData获取员工表中满足条件的行的记录
Dictionary<string, object> data = this.DataAccess.GetTableData("员工表", valuepair); //发现Bug 是没找到存在的ID号,会提示出错中止执行,正常没找到时,这是
if (data.Count != 0)
{
//使用AddTableData发法将获取的记录添加到数据表中
//this.DataAccess.AddTableData("员工表", data);
}
}
}
****************如果发现没找到存在内表的记录时,就会提示出以下错误,程序中止,这不应该的,以前这是就返回 data.Count=0 值。
Request Exception Happened-------------------------------
Path/customapi/myapi/testpostapi_pcregistred
{
"ClassName": "System.InvalidOperationException",
"Message": "没有任何记录存在。",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at Forguncy.KatanaMiddleware.CustomApiDataAccess.GetTableData(String tableName, ColumnValuePair primaryKey)
at MyAPI.MyAPI.Hua_QueryBT_ToSring(String hua_queryB, String findcolumnName, String hua_Value, String hua_returncolumn)
at MyAPI.MyAPI.TestPostAPI_PcRegistred()
at Forguncy.KatanaMiddleware.CustomApiMiddleware.a(HttpContext A_0)
at Forguncy.KatanaMiddleware.CustomApiMiddleware.InvokeAsync(HttpContext context)
at Forguncy.KatanaMiddleware.ConcurrentControllMiddleware.InvokeAsync(HttpContext context)
at Forguncy.Server2.KatanaMiddleware.StartPageMiddleware.InvokeAsync(HttpContext context)
at Forguncy.Server2.KatanaMiddleware.HttpHeaderMiddleware.InvokeAsync(HttpContext context)
at Forguncy.KatanaMiddleware.ExceptionTraceMiddleware.InvokeAsync(HttpContext context)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233079,
"Source": "Forguncy.Server2",
"WatsonBuckets": null
}
|