Hello everyone,

I've a little problem with updating my Access DB.
I use this code to update my db in vb.net.

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Try
            oledbCmdBuilder = New OleDbCommandBuilder(adapter)
            changes = ds.GetChanges()
            If changes IsNot Nothing Then
                adapter.Update(ds.Tables(0))
            End If
            ds.AcceptChanges()
            bgw.WorkerReportsProgress = True
            bgw.RunWorkerAsync()
            ' MsgBox("Save changes")
        Catch ex As Exception
            SendMail(ex.ToString)
        End Try
    End Sub

The declarations i've made public so that code is.:

 sql = "SELECT * FROM data where DATE >= #" + waarde71 + "# order by BATCH desc" 'maand/dag/jaar

 Public ds As New DataSet()
 Public adapter As New OleDbDataAdapter(sql, VerbindingsConnectie)
 Public changes As DataSet
 Public oledbCmdBuilder As OleDbCommandBuilder  

When i test my program with the update code everything works perfect, but when i try to update the column CONTAINER i get a error.
I know this can be a problem because the word CONTAINER is a used function in access.
If u use the normal update command line u can fix this to put it between [] so it becomes [CONTAINER].

So i thought, make the sql rule like this.:

Public sql As String = Sql = "SELECT id, ITEM, Recept_nr, BATCH, [CONTAINER], [DATE], MIC_BG, MIC_OS, MIC_REM, TRANSPARAN, SCRATCHES, FOG, SI, VISCOSITY, VISCO_STATUS, BLENDING, TACK, TACK_STABI, WATER_UPTAKE, RELEASE, VIS_DUKE, YIELD_DUKE, FLOW_1M, FLOW_5M, FLOW_STATUS, FLOW_REMEAS_1M, FLOW_REMEAS_5M, STATUS, Remark FROM data where DATE >= #" + waarde71 + "# order by BATCH desc"

But that did'nt do the trick.
My question is now , how can i fix this , I've gone through my ideas.

Solved it to use QuotePrefix = "[" and QuoteSuffix = "]" in my oledbbuilder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.