This topic is locked

SQL Lookup

11/22/2019 12:53:17 PM
ASPRunnerPro General questions
goffj1 author

I have a form with a field [ContactEmail] that I want to auto-populate with an email address based on the session UserID returned by the Active Directory login.
A table named CONTACTS is in the project and it has fields [UserID] and [ContactEmail]. There are no duplicate UserID's or ContactEmail's in the table CONTACTS.
SELECT Contacts.ContactEmail

FROM Contacts

WHERE Contacts.UserID = session("UserID")
Setting the field as a "Lookup" I can get the drop down to display the desired ContactEmail but you have to click the down arrow and select the only item on the list.

Would like to set the field as "text" type and auto-populate the users email address when "add" form opens.
Is there a better approach as I can't seem to get this working?

Nir Frumer 11/22/2019


In after seccesfull login on the login page events


$_SESSION['ContactEmail']= $data['ContactEmail'];
Then use


as the default value for your form.
hope it helps,

goffj1 author 11/25/2019

Won't compile, syntax errors

admin 12/17/2019

That was PHP. It is not clear if you use ASPRunnerPro or ASPRunner.NET. This is ASPRunnerPro forum but compile errors mean you use ASPRunner.NET.
In C# use, respectively

XSession.Session["ContactEmail"]= data["ContactEmail"];

and then