在 LINQ 中,我试图编写一个查询,一旦单击按钮,就会从数据库表中删除一条记录,即“Amendments_Awaiting_Approval”。将根据在文本框中输入的值找到并删除该行。到目前为止我有这个:'你的输入字符串
Dim parseRef As String = txtReferenceCode.Text
'Convert string to integer value '
Dim deleteRecord As Integer = Integer.Parse(parseRef)
' Query the database for the rows to be deleted. '
Dim deleteModuleChanges = _
From amendments In db.Amendments_Awaiting_Approvals _
Where amendments.Amendments_ID = deleteRecord _
Select amendments
For Each amendment As Amendments_Awaiting_Approval In deleteModuleChanges()
db.OrderDetails.DeleteOnSubmit(detail)
Next
此段不工作。该页面甚至不会加载,当我将鼠标悬停在 deleteModuleChanges() 部分时,我收到错误“重载解析失败,因为没有可访问的 ElementAtOrDefault 接受此数量的参数”
有任何想法吗?