Bindingsource not updating database
I've already managed to connect with SQL Server Express 2008, using a Function ("consulta") inside a Module ("db"): Dim ad As Sql Data Adapter = New Sql Data Adapter Function consulta(By Val tabela As String, Optional opt As Boolean = False, Optional optparam As String = "") As Data Set Dim ds As New Data Set Try Dim connstring As String = "Data Source=NOTEBOOK\SQLEXPRESS; Initial Catalog=Sys Market; Persist Security Info=True; User ID=admin; Password=XXXXXX" Dim con Obj As New Sql Connection(connstring) Dim sql As String If opt = True Then sql = "SELECT * FROM " & tabela & " " & optparam Else sql = "SELECT * FROM " & tabela End If Dim cmd As Sql Command = New Sql Command(sql, con Obj) ad. Update(data, table Name) End Using End Sub Private Sub btn Save_Click(sender As Object, e As Event Args) Handles btn Save. This is my first post in here, but this forum already helped me a lot. Close() Return ds Catch ex As Exception Message Box. First, sorry for my English, i'm from Brazil and i'm trying to write without a translator. Click ' If items remain in the list, remove the first item. Add("Text", binding Source1, "Capital") End Sub Private Sub button1_Click(By Val sender As Object, By Val e As Event Args) _ Handles button1.
You are creating the new Data Binding Projection() so we are assuming this is a class that is controlled by your context right?
I have a Data Grid View made of a Data Set of a table from the DB.
When I delete a row, it is updated in the database but it is not removed from the Grid View.
If you want to change records that are at the database, you should not use the Linq approach where you create a new object, you should call the object itself, so it can have the EF proxies and be tracked by the Change Tracker of EF.
For me it seems that you have a new class that is not tracked by EF.....