Is is possible?

topic posted Tue, May 2, 2006 - 8:16 AM by  Grant
I was wondering if it is possible to make a contact form that emails me the information the person inputs in the form and then saves that information as well in a database?

If so could someone help me?

Should I make databound fields or use the normal <asp:textbox id="name" ...> and then try somehow to make that information insert into a database?
posted by:
Grant
Florida
  • Re: Is is possible?

    Tue, May 2, 2006 - 11:41 AM
    Yes, it is possible.

    Just use normal asp controls

    Have your submit button call two functions with the data:

    SaveContactInfo(Name as string, etc...)
    EmailContactInfo(Name as string, etc...)

    SaveContactInfo will
    1) Open a connection to a database
    2) Create a command to call a stored procedure in the database
    3) Append parameters to the command from data supplied by the user
    4) Execute the command

    EmailContactInfo will
    1) Create a new mail message
    2) Place the contact info in the message
    3) Set the To Address to the desired email address
    4) Set the From Address to an address that can send mail from your domain
    5) Send the message

    If you really want to get sexy, you can create a ContactInfo class that gets filled by the form data using a contsructor

    Public Sub New(Name as string, etc...)

    then has these two methods

    SaveContactInfo()
    EmailContactInfo()

    that simply use the internal data. And you can use the ContactInfo object elsewhere in your app...

Recent topics in "ASP.net web development"

Topic Author Replies Last Post
graphics in asp Toby 0 August 9, 2008
Does anybody know? Grant 2 January 2, 2008
How to create asp.net pages dynamically? Grant 1 January 2, 2008
question about isPostBack Eira 3 November 2, 2007