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?
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?
-
Re: Is is possible?
Tue, May 2, 2006 - 11:41 AMYes, 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...