Problem: I am working on a console application and I have a table in my .DBML File as FirstTable
I am using following code written below to update a field "Father Name" but it is still not updating it in Relational Database MS SQL.
VB Code:
Imports System.Data
Imports System.Collections.Generic
Module Module2
Dim DB As New NorthWinddatacontext()
Sub main()
Dim UpdateName = (From p In DB.FirstTables Where p.Name = "Yousuf"
Select p).Single
UpdateName.FatherName = "Hashmi1"
DB.SubmitChanges()
End Sub
Imports System.Collections.Generic
Module Module2
Dim DB As New NorthWinddatacontext()
Sub main()
Dim UpdateName = (From p In DB.FirstTables Where p.Name = "Yousuf"
Select p).Single
UpdateName.FatherName = "Hashmi1"
DB.SubmitChanges()
End Sub
My code is not working
Solution: You have not set any Primary Key on Your Table in your Relational Database.Make a Primary Key and try the same code again by Droping the table again on Your DBML.