テーブル間でデータを移動する必要があります。2 つのテーブルは、各フィールドのデータ型に関して同一です。ただし、あるテーブルからデータを取得して別のテーブルに配置しようとすると、エラーが発生します。これは非常に複雑なプログラミング方法であることは間違いありませんが、この段階で私が知っている唯一の方法です。Value of type 'System.Linq.IQueryable(Of Integer)' cannot be converted to Integer
データ型に応じて、取得するフィールドごとに、または同等のものを取得します。私はこれに3日間苦労しています。助けてください!
`input string`
Dim parseRef As String = txtReferenceCode.Text
`Convert string to integer value`
Dim findRecord As Integer = Integer.Parse(parseRef)
`Query the database for the row to be updated.`
Dim modQuery = _
(From m In db.Modules
Join am In db.Amendments_Awaiting_Approvals On m.Module_code Equals am.Module_code
Where am.Amendments_ID = findRecord _
Select m)
Dim newName = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Module_name_app)
Dim newStatus = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Module_status_app)
Dim newCredits = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Module_credits_app)
Dim newCapacity = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Module_capacity_app)
Dim newFee = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Fee_change)
Dim newDesc = (From n In db.Amendments_Awaiting_Approvals
Where n.Amendments_ID = findRecord
Select n.Module_Description_app)
` Execute the query, and change the column values
you want to change. NB all fields on right had side hold the temp data to be input`
For Each m As [Module] In modQuery
m.Module_name = newName
m.Module_status = newStatus
m.Module_credits = newCredits
m.Module_capacity = newCapacity
m.Fee = newFee
m.Module_Description = newDesc