0

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..

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by arcobaleno
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.