我正在运行这段代码,基本上我有一个存储过程,它将新行插入表中member
。我已经发布了从 C# 调用存储过程的方法的代码以及我调用该方法的代码:
存储过程:
[AutoComplete(true)]
public void AddNewMember(Member cm)
{
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
try
{
this.Connection.BeginTransaction();
this.InitializeConnection();
cmd = new SqlCommand("sp_addNewMember", this.Connection);
cmd.Parameters.Add(new SqlParameter("@memberID", cm.MemberID));
cmd.Parameters.Add(new SqlParameter("@userID", cm.UserID));
cmd.Parameters.Add(new SqlParameter("@dateJoined", cm.DateJoined));
cmd.Parameters.Add(new SqlParameter("@Duties", cm.Duties));
cmd.CommandType = CommandType.StoredProcedure;
da.InsertCommand = cmd;
ContextUtil.SetComplete();
}
catch (Exception ex)
{
ContextUtil.SetAbort();
}
调用方法:
DataLayer.Member cm = new DataLayer.Member();
cm.MemberID = Guid.NewGuid();
cm.UserID = new Guid(txtUserID.Text);
cm.DateJoined = Convert.ToDateTime(txtDateJoined.Text);
cm.Duties = txtDuties.Text;
DataLayer.AddMember acm = new DataLayer.AddMember();
acm.AddNewMember(cm);
acm.AddNewMember()
上线抛出的异常:
System.Runtime.Serialization.SerializationException:找不到程序集“DataLayer,版本=1.0.0.0,Culture=neutral,PublicKeyToken=536d0c71bd79a82e”
请问有人知道是什么问题吗?