Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Please check code
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

mafifi
Junior Member

USA
308 Posts

Posted - 27 June 2001 :  20:54:48  Show Profile  Send mafifi an ICQ Message
This is a partial code for an application that collects information from a form where you request the UserID and DepartmentID. The code will append @MYDOMAIN.COM to the end of the user’s ID to obtain the e-mail address.

What I want to do is to get the First and Last names from another table using the User’s ID as a locator. For example, if the user ID is DOEJ that means that the user’s first name is John and the last name is Doe. And before I do that I want to make sure that the UserID is in the Database first.
quote:

<%
Set conn = Server.createobject ("ADODB.Connection")
conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\Inetpub\wwwroot\mydomain\mydatabase.mdb;"

If Not Isempty(Request.Form("Send")) Then
EmailAddress = Request.Form("UserID") & ("@MYDOMAIN.com")
CurrentDateTime = now
'Name = XXXXXXXXXXXX

conn.Execute "Insert INTO TableEmp (ID, Name, EmailAddress, DepartmentID, WhenSent)
values (" & Request.Form("ID") & "', " _
& "'" & Name & "', " _
& "'" & EmailAddress & "', " _
& "'" & Request.Form("DepartmentID") & "', " _
& "'" & CurrentDateTime & "')"

Response.Clear
Response.Redirect "Thankyou.asp"
%>



Your help is appreciated.


Thanks,

Mo

Doug G
Support Moderator

USA
6493 Posts

Posted - 27 June 2001 :  22:29:49  Show Profile
Something like:

If Not Isempty(Request.Form("Send")) Then
EmailAddress = Request.Form("UserID") & ("@MYDOMAIN.com")
CurrentDateTime = now
Set rs = con.execute("SELECT FirstName, Lastname FROM table WHERE UserID = " & Request.Form("UserID"))
If Not rs.BOF and not rs.EOF Then
...
...
Else
'No name in DB
End If
...


You'll have to fill in a few blanks, this is just an off the top idea not complete tested code.



======
Doug G
======
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 28 June 2001 :  09:55:22  Show Profile  Send mafifi an ICQ Message
Doug G,

Thanks for the lead.

Thanks,

Mo
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.38 seconds. Powered By: Snitz Forums 2000 Version 3.4.07