Im a beginner and having a hard time on searching for a solution.Im using vb.net and ms access as database. Here is my problem
The SQL works fine when i debug in the project, but once i make the setup and install it shows the error?
operation must use an updateable
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
DateTimePicker1.Refresh()
DateTimePicker1.Value = DateTime.Now
DATEANDTIMEtxt.Text = CType(DateTimePicker1.Value, String)
If TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox("plz fill the info")
Else
Try
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\DB_HR.accdb;Jet OLEDB:DATABASE PASSWORD=dbhr123;")
Dim Str As String = "Insert Into LOGIN([YOUR_NAME],[PASSWORD],[DATEANDTIME]) Values (?,?,?)"
Dim cmd As New OleDbCommand(Str, conn)
cmd.Parameters.Add(New OleDbParameter("YOUR_NAME", CType(TextBox4.Text, String)))
cmd.Parameters.Add(New OleDbParameter("PASSWORD", CType(TextBox5.Text, String)))
cmd.Parameters.Add(New OleDbParameter("DATEANDTIME", CType(DATEANDTIMEtxt.Text, String)))
conn.Open()
cmd.ExecuteNonQuery() '<------Error say's it was here
MsgBox("Create success")
conn.Close()
Panel1.Visible = False
TextBox4.Clear()
TextBox5.Clear()
TextBox4.Select()
TextBox1.Enabled = True
TextBox2.Enabled = True
Button1.Enabled = True
Button2.Enabled = True
TextBox1.Text = ""
TextBox1.Select()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End If
End Sub
this is the error
System.Data.Oledb.OledbExeption (0x80004005): Operation must use an updateable query.
at WindowsApp1.Form1.Button4_Click(Object sender, EventArgs e) in C:\Users\Alex\Desktop\HR_appP2 w password\WindowsApp1\WindowsApp1\Form1.vb:line 112
What I have tried:
I have already try the this
I change my application in Administrator Privilege
Change Level From
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
To
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
I have checked the permissions on the folder that contains the Access file.
Is it the way how I build it?