0

Light Silver Project 中读取的数据量Datagrid1.SelectedItems没有问题,但是当我在服务器上运行应用程序时出现以下错误:

尝试通过方法'Microsoft.VisualBasic.CompilerServices.Symbols+Container.InvokeMethod(Method, System.Object[], Boolean[], System.Reflection.BindingFlags)' 访问方法'VB$AnonymousType_9 6<System.__Canon,System.__Canon,System.Nullable1,System.Nullable`1, System.Int32,System.__Canon>.get_Contacts_Name()' 失败。

我的代码是:

标题

Private Sub LoadDataGridItems(sender As Object, e As EventArgs)
    Try
        Dim linq = (From n In ds.tbl_PHContacts Where n.Contacts_Name.ToString.Trim.Contains(txtContactName.Text) And n.Contacts_Location.ToString.Trim.Contains(txtLocation.Text) And n.Contacts_OfficeID.Equals(My_Class.CurrentUserOfficeId) Select New With { _
                    .Contacts_Name = n.Contacts_Name, _
                    .Contacts_Location = n.Contacts_Location, _
                    .Contacts_IsPrivate = n.Contacts_IsPrivate, _
                    .Contacts_IsPersonalize = n.Contacts_IsPersonalize, _
                    .Contacts_ID = n.Contacts_ID, _
                    .Contacts_Image = n.Contacts_Image
                    })
        DataGrid1.DataContext = ds.tbl_PHContacts
        DataGrid1.ItemsSource = linq
    Catch ex As Exception
        MessageBox.Show(ex.Message, "phSearch.LoadDataGridItems", MessageBoxButton.OK)
    End Try
End Sub



  Private Sub DataGridimgEdit_Click(sender As System.Object, e As System.Windows.Input.MouseButtonEventArgs)
      Try
          Dim frm As New phRegister
          frm.Tag = DataGrid1.SelectedItems(0).[Contacts_ID].ToString
          frm.Show()
      Catch ex As Exception
          MessageBox.Show(ex.Message, "phSearch.DataGridimgEdit_Click", MessageBoxButton.OK)
      End Try
  End Sub
4

0 回答 0