I’m trying to create Web Application using ASP.Net via Visual Studio 2010.
The Database that I use is Access, with connection Method OleDb

When using the query “Update” or “Delete”, the programs shows no errors, but the data in Access does not change.
While for query “Select” and “Insert”, the data is displayed and inserted successfully.

The Following code is the sample query “Delete” that I used..

Imports System.Data.OleDb

Partial Class frmTEst
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
       
    Dim dbConnection As OleDbConnection
        Dim dbCommand As OleDbCommand
        Dim sqlString As String

        dbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("App_Data/dbKAE.mdb"))
        dbConnection.Open()

        sqlString = "DELETE FROM tblPengawasan WHERE no='31'"

        dbCommand = New OleDbCommand(sqlString, dbConnection)
        dbCommand.ExecuteNonQuery()

    End Sub
End Class

Previously I tried a direct query using AccessDataSource, but the result just the same, “Update” and “Delete” can’t be done. But the “Select” and “Insert” can be executed successfully.

Is there any problem with my Access configuration or whether the problem is in the coding itself..?
Please Help..

What exactly is no? Is it a column in the table?

no is a column in the table.. and 31 is just example value..

btw, i already got the solution for my problem..
the problem is type Miss Match.. the type of "no" column is autonumber. so rather than user no='31', i should use no=31.

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.