[英]vb.net linq Insert new record
Im trying to insert a new record though linq. 我试图通过linq插入新记录。 im able to update and read data with out any problem.but i just cant figure out how to just inset a new record. 我能够毫无问题地更新和读取数据。但我只是想不出如何插入新记录。 here is a start of my function. 这是我功能的开始。 i know its not done yeat. 我知道还没有完成。 all help would be nice. 所有帮助将是很好。
Public Function AddAddressInfo(ByVal objdeptGUID As String, ByVal objGEOCode As String, ByVal objArressCommonName As String, ByVal objStreetAddress As String, ByVal objAddressNotes As String, ByVal objIsPublic As Boolean, ByVal objSesionToken As String)
''#Check of Token is good
If CheckToken(objSesionToken, objdeptGUID) = False Then
Return "Error"
End If
Try
Dim lqAlarms As New linqAlarmDumpDataContext
Dim AddInfo = From r In lqAlarms.tbAddressInfos
Where r.DeptGUID = objdeptGUID
Select r
Catch ex As Exception
End Try
End Function
Use the InsertOnSubmit()
and SubmitChanges()
to insert your records. 使用InsertOnSubmit()
和SubmitChanges()
插入您的记录。
Dim lqAlarms As New linqAlarmDumpDataContext
Dim info As New tbAddressInfo With { ... } ' Create the record
lqAlarms.tbAddressInfos.InsertOnSubmit(info) ' Insert the record
lqAlarms.SubmitChanges() ' Commit the insertion
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.