Re: Using Access Database as Membership source

On Apr 26, 12:08 am, James <J...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I am quite new to membership and security etc. I have a large Access DB and
want to create a special section on a website for some of the members in the

I have looked how to do this and have found about 10 sites, all with
different ways to do this. I have tried all but none work. The code I have
got closest to working is:

<authentication mode="Forms"/>
defaultProvider="AccessMembershipProvider" >
<add name="AccessMembershipProvider"
OLEDB.4.0;Data Source=C:\NewMembershipProvider\
App_Data\Members.mdb;Persist Security
Info=False" />


Private connStr As String
Private comm As New OleDb.OleDbCommand

Private _requiresQuestionAndAnswer As Boolean
Private _minRequiredPasswordLength As Integer

Public Overrides Function ValidateUser( _
ByVal username As String, _
ByVal password As String) As Boolean

Dim conn As New OleDb.OleDbConnection(connStr)
Dim sql As String = _
"Select * From Membership WHERE " & _
"username=@username AND password=@password"
Dim comm As New OleDb.OleDbCommand(sql, conn)
comm.Parameters.AddWithValue("@username", _
comm.Parameters.AddWithValue("@password", _
Dim reader As OleDb.OleDbDataReader = _
If reader.HasRows Then
Return True
Return False
End If

Catch ex As Exception
Return False
End Try
End Function

That code comes up with errors about the OleDb.OleDbCommand saying I should
put Data. infront of it.

Is there anyone who can point me in the right direction on how to do this?

Many thanks


James, your code is working for me.
Can you post here the complete error message?


Relevant Pages

  • Re: Incompatibility between Access 2003 and Access 2002
    ... Private WithEvents mlst As ListBox ... Private mot As ObjectType ... Public DisplayField As String ... Dim prm As DAO.Parameter ...
  • MAPI Emails from Access
    ... I realize this code is quite long, but could someone take a look at the sub ... Private Const mcERR_DOH = vbObjectError + 10000 ... Private mstStatus As String ... Dim db As Database, rs As Recordset ...
  • Re: FileSystemWatcher advice required please
    ... Private ArchiveImport As String ... Private FilesToProcess As ProcessFiles ... Public Sub Main ... Dim NoVersion As New Collection ...
  • Re: Is there a way to prevent a RichTextBox from scrolling?
    ... Private _isRegex As Boolean ... Public Sub New(ByVal thispattern As String, ... Dim entry As tDict ...
  • Re: vb6 print dialog problem
    ... Private Const HWND_BROADCAST = &HFFFF ... dmDeviceName As String * CCHDEVICENAME ... Private Declare Function WriteProfileString _ ... Dim sTemp As String * 512, ...