To connect to a database, do something like the following:
Include the following in your Web.config:
<configuration>
<appSettings>
<add key="connectionstring" value="YOUR CONNECTION STRING"/>
</appSettings>
</configuration>
Use something similar to the following to submit to the database:
Dim myconnection As New
System.Data.OleDb.OleDbConnection(System.Configuration.ConfigurationManager.AppSettings("connectionstring"))
Dim cmdsubmit As New OleDbCommand("YOUR SQL STATEMENT", myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()
To send an email:
Include the following in your Web.config:
<configuration>
<appSettings>
<add key="smtpserver" value="YOUR SMTP SERVER"/> 'For example,
"smtp.yourdomain.com"
</appSettings>
</configuration>
Dim toaddress As New MailAddress("(e-mail address removed)", "Nathan
Sokalski")
Dim fromaddress As New MailAddress("(e-mail address removed)", "Nathan
Sokalski")
Dim commentsender As New
SmtpClient(System.Configuration.ConfigurationManager.AppSettings("smtpserver"))
commentsender.Credentials = New NetworkCredential("", "") 'This line may or
may not be necessary, ask your Webhost or network administrator
Dim commentmsg As New MailMessage(fromaddress, toaddress)
commentmsg.IsBodyHtml = False
commentMsg.Subject = "YOUR EMAIL SUBJECT"
commentMsg.Body = "YOUR MESSAGE BODY"
commentsender.Send(commentMsg)
If either of these do not work, look at the error messages to help determine
the reason. The reason (if there is one) is most likely due to server
configuration. If you have problems, post your code and the error, we may be
able to help you more with that info. Good Luck!