protected void Button4_Click(object sender, EventArgs e)
{
linqtosqlDataContext db = new linqtosqlDataContext();
EntitySet<LeaveWord> leaveword = db.Member.Single(u => u.Accounter.Equals("xb")).LeaveWord;
leaveword.Remove(leaveword[4]);
leaveword.RemoveAt(5);
leaveword.Clear();
db.SubmitChanges();
Label4.Text =leaveword.Count.ToString();
}
以上三种修改数据库的方法都会引起指定转换无效的错误,还有下面的方法也会引起同样的错误
protected void Button7_Click(object sender, EventArgs e)
{
linqtosqlDataContext db = new linqtosqlDataContext();
EntitySet<LeaveWord> leaveword1 = db.Member.Single(u => u.Accounter.Equals("xb")).LeaveWord;
EntitySet<LeaveWord> leaveword2 = db.Member.Single(u => u.Accounter.Equals("GJ")).LeaveWord;
leaveword2.Assign(leaveword1);
db.SubmitChanges();
}
什么错误?可以具体说一下吗
u => u.Accounter.Equals("xb")
-----------------
Linq2SQL,可能不支持将这个表达式转换成SQL的where条件,试下u => u.Accounter == "xb"
没有完整代码很难找到是什么错误的。。最好把整个项目文件啊传上来。。这样我们可以下载下来调试。