2014-04-11 3 views
0

나는 꽤 많은 C#에서 엔티티 프레임 워크를 사용하고 거기에 무엇을 해야할지,하지만 어떻게 내가 내 목록에있는 항목에 액세스 할 한 :VB에서 # 엔티티 개체에 액세스하는 방법을 이해하지 못합니까?

txtboxOrderNunber.Text=records.ordernumber 
: 나는이 작업을 수행 할 수 있도록

Dim records As List(Of R3Delivery) 
    records = threeContext.GetAllDeliverysByRecordId(41) 

이것은 내가 위의 방법 덕분를 사용하여 업데이트를 절약 할 방법도 제 기능

Function GetAllDeliverysByRecordId(ByVal recorId As Int16) As List(Of R3Delivery) 
    Dim retVal As New List(Of R3Delivery) 
    retVal = (From u In dbContext.R3Delivery Where u.r3DeliveryId = recorId Select u).ToList() 


    Return retVal 

End Function 

된다. saveedit

records.Item(0).qty = txtQty.Text 
    records.Item(0).isDelivered = chkNotDelivered.Checked 
    Try 
     threeContext.dbContext.SaveChanges() 
     MessageBox.Show("Changes saved to the database.") 
     Close() 
+0

정확하게 C#에서와 같은 방식으로 저장합니다. – Styxxy

+0

@Styxxy 내 저장보기 자신의 저장을 수정하지만 gridview 창을 닫을 때까지 내 gridview를 새로 고치지 않습니다. – rogue39nin

+0

@Styxxy 여기에 다른 stitack이 있습니다 [link] http://stackoverflow.com/questions/23011805/grid-only -updating-main-gridwindow-is-closed? noredirect = 1 # comment35149313_23011805 – rogue39nin

답변

0

은 내가 더를 일부러 확인 첫 번째 비트는 내가 항목을 사용했다 있어요 (0) .fieldname approcah 다음

Dim records As List(Of R3Delivery) 
    records = threeContext.GetAllDeliverysByRecordId(41) 
    txtQty.Text = records.Item(0).qty 

하지만 아래에 내가 어떻게 엔티티를 다시 저장처럼 내가 바꿀 때?

+0

또는 목록을 반환하지 않고 항목을 반환 하시겠습니까? –

관련 문제