Group: Forum Members
Posts: 48,
Visits: 130
|
Hi all. I have a login form that has a combo box that lists users. When the user selects himself his ID ( a primary key value in the table) is loaded in lnValue and sent to my function GetEmployeeByID. The idea is to get the execute the query and return the one record based on the ID value using the GetByPrimaryKey Method. For some reason no matter what value is sent thru ID the return is always from the first record with a ID value of 1. I have used the debugger to check values of ID to the function and it is 2 that is being sent but when I get back to my form the password in the dataset is from record 1. Clear as mud? In other words I'm asking for record 2 and am getting record 1. So,is my code correct or have I not understood your example of how to use the GetByPrimaryKey? BWT, ID is the primary key for this table.
Regards,
Robert
---CODE FROM MY FORM------
Dim lnValue as Integer
'-- Get the ID from the selected name in the combo box
lnValue = CType(txtFullName.SelectedValue, Integer)
'-- Send the ID to the Function that will get the Password from the DB of the selected user
Me.EmployeeBO1.GetEmpoyeeByID(lnValue)
---CODE FROM MY EMPOYEEBO1-------
Public Function GetEmpoyeeByID(ByVal ID As Integer)
Return Me.GetByPrimaryKey(ID)
End Function
|