Another problem in my program is that I can't get my access database to update. It works on the other fields here is the code
Public Sub Lockuser(ByVal path As String, ByVal userId As String, ByVal access As Boolean)
Dim sqlConn As OleDbConnection
Dim oCommand As OleDbCommand
Dim stmt As String
Dim param As OleDbParameter
' This sets up the connection to the database including the path passed in
sqlConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & path & "")
sqlConn.Open()
oCommand = New OleDbCommand()
oCommand.Connection = sqlConn
stmt = "UPDATE tblUsers SET Access = @access" & " WHERE(tblUsers.UserID = @userId)"
'declare parameter objects for the command object
param = New OleDbParameter()
param.ParameterName = "@userId"
param.Value = userId
oCommand.Parameters.Add(param)
param = New OleDbParameter()
param.ParameterName = "@access"
param.Value = False
oCommand.Parameters.Add(param)
oCommand.CommandText = stmt
oCommand.CommandType = CommandType.Text
oCommand.ExecuteNonQuery()
sqlConn.Close()
End Sub
I've tried a yes/no and text field but it won't update in access. Am I missing a step?