我正在使用WF,我正在製作書籤。 當我寫下面我可以刪除這個活動非常好:當我在書籤中使用數據庫時發生錯誤:調用的目標引發異常
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Activities.Validation;
using Microsoft.VisualBasic.Activities;
using System.Windows;
using System.Data;
using System.Linq;
using SimpleWebDesigner.ServiceReference1;
namespace SimpleWebDesigner.Bookmark_exmple
{
class newBookmark: NativeActivity
{
Service1Client ser = new Service1Client();
[RequiredArgument]
public OutArgument<bool> Out_arg { get; set; }//=new OutArgument<string>(output);// { get; set; }
protected override void Execute(NativeActivityContext context)
{
context.CreateBookmark("samename", new BookmarkCallback(OnBookmarkCallback));
}
protected override bool CanInduceIdle
{
get
{
return true;
}
}
void OnBookmarkCallback(NativeActivityContext context, Bookmark bookmark, object val)
{
bool approve;
approve = (bool)ser.get_from_WF(1);
Out_arg.Set(context, approve);
}
}
}
喜歡本頁https://skydrive.live.com/?cid=F1FD3CCD21D87C68&id=F1FD3CCD21D87C68%21351&sc=documents
但是當我閱讀並通過WCF從數據庫中寫道,如下面的代碼:
class newBookmark: NativeActivity
{
Service1Client ser = new Service1Client();
[RequiredArgument]
public OutArgument<bool> Out_arg { get; set; }//=new OutArgument<string>(output);// { get; set; }
void OnBookmarkCallback(NativeActivityContext context, Bookmark bookmark, object val)
{
bool approve;
string exp;
approve = (bool)ser.get_from_WF(1);
if (approve == true)
exp = "momo";
else
exp = "yoyo";
Out_arg.Set(context, exp);
}
當我想放棄此活動時,它沒有顯示彈出式窗口,並顯示以下錯誤:異常已由調用的目標引發
有什麼幫助嗎? 謝謝。
請發佈您的異常的堆棧跟蹤。我們無法猜測它從哪裏來。 – Amy
在我運行該項目之前,它不在運行時,當我將它拖放到XMAL文件中時。 – Sofy