InfoDb is my Access Database. It contains the ff columns: UserName, Password, and FirstName.
_AccName is the passed text in UNameTB-textbox in my login form which pertains to the UserName in my database.
AccountName is a label in my useraccount form. When successfully logged in, it must be changed to the corresponding FirstName value in my database that matched the Username given by the passed value.
but my coding is obviously wrong since it does not. im getting this error after successfully logging in: No given value for one or more required parameters.
Heres the code for passing value from login code
'passed details starts here Dim Obj As New UserAccount Obj.PassedText = UNameTB.Text 'end
My coding for useraccount form:
Public Class UserAccount Private _AccName As String Private mstrConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=" & Application.StartupPath & "\InfoDb.accdb;" Public Property [PassedText]() As String Get Return _AccName End Get Set(ByVal Value As String) _AccName = Value Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(mstrConn) Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand("SELECT FirstName FROM DB where UserName= " & _AccName & " ", conn) Dim getInfo As OleDb.OleDbDataReader conn.Open() getInfo = cmd.ExecuteReader While getInfo.Read AccountName.Text = getInfo.ToString() End While conn.Close() End Set End Property End Sub End Class