Note that there are some explanatory texts on larger screens.

plurals
  1. PODo I have to manually enter info from an asp.net 4 email into an MS Database?
    text
    copied!<p>I have a form email, asp.net 4.0 / VB / Visual Studio, and I want it to go automatically into a Microsoft Access DB without any effort from me. Is this possible? I'm not a programmer, but here's the form e-mail:</p> <blockquote> <pre><code>&lt;script runat="server"&gt; Protected Sub SubmitForm_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsValid Then Exit Sub Dim SendResultsTo As String = "me@domain.com" Dim smtpMailServer As String = "smtp.domain.com" Dim smtpUsername As String = "me@domain.com" Dim smtpPassword As String = "******" Dim MailSubject As String = "Form Results" Try Dim txtQ As TextBox = Me.FormContent.FindControl("TextBoxQ") If txtQ IsNot Nothing Then Dim ans As String = ViewState("hf1") If ans.ToLower &lt;&gt; txtQ.Text.ToLower Or ans.ToUpper &lt;&gt; txtQ.Text.ToUpper Then Me.YourForm.ActiveViewIndex = 3 Exit Sub End If End If Dim FromEmail As String = SendResultsTo Dim msgBody As StringBuilder = New StringBuilder() Dim sendCC As Boolean = False For Each c As Control In Me.FormContent.Controls Select Case c.GetType.ToString Case "System.Web.UI.WebControls.TextBox" Dim txt As TextBox = CType(c, TextBox) If txt.ID.ToLower &lt;&gt; "textboxq" Then msgBody.Append(txt.ID &amp; ": " &amp; txt.Text &amp; vbCrLf &amp; vbCrLf) End If If txt.ID.ToLower = "email" Then FromEmail = txt.Text End If If txt.ID.ToLower = "subject" Then MailSubject = txt.Text End If Case "System.Web.UI.WebControls.CheckBox" Dim chk As CheckBox = CType(c, CheckBox) If chk.ID.ToLower = "checkboxcc" Then If chk.Checked Then sendCC = True Else msgBody.Append(chk.ID &amp; ": " &amp; chk.Checked &amp; vbCrLf &amp; vbCrLf) End If Case "System.Web.UI.WebControls.RadioButton" Dim rad As RadioButton = CType(c, RadioButton) msgBody.Append(rad.ID &amp; ": " &amp; rad.Checked &amp; vbCrLf &amp; vbCrLf) Case "System.Web.UI.WebControls.DropDownList" Dim ddl As DropDownList = CType(c, DropDownList) msgBody.Append(ddl.ID &amp; ": " &amp; ddl.SelectedValue &amp; vbCrLf &amp; vbCrLf) End Select Next msgBody.AppendLine() msgBody.Append("Browser: " &amp; Request.UserAgent &amp; vbCrLf &amp; vbCrLf) msgBody.Append("IP Address: " &amp; Request.UserHostAddress &amp; vbCrLf &amp; vbCrLf) msgBody.Append("Server Date &amp; Time: " &amp; DateTime.Now &amp; vbCrLf &amp; vbCrLf) Dim myMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage() myMessage.To.Add(SendResultsTo) myMessage.From = New System.Net.Mail.MailAddress(FromEmail) myMessage.Subject = MailSubject myMessage.Body = msgBody.ToString myMessage.IsBodyHtml = False If sendCC Then myMessage.CC.Add(FromEmail) Dim basicAuthenticationInfo As New System.Net.NetworkCredential(smtpUsername, smtpPassword) Dim MailObj As New System.Net.Mail.SmtpClient(smtpMailServer) MailObj.Credentials = basicAuthenticationInfo MailObj.Send(myMessage) Me.YourForm.ActiveViewIndex = 1 Catch Me.YourForm.ActiveViewIndex = 2 End Try End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsPostBack Then Dim lbl As Label = Me.FormContent.FindControl("labelq") If lbl IsNot Nothing Then Dim rq(3) As String rq(0) = "Is fire hot or cold?" rq(1) = "Is ice hot or cold?" rq(2) = "Is water wet or dry?" Dim ra(3) As String ra(0) = "hot" ra(1) = "cold" ra(2) = "wet" Dim rnd As New Random Dim rn As Integer = rnd.Next(0, 3) lbl.Text = rq(rn) ViewState("hf1") = ra(rn) End If End If End Sub &lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"&gt; &lt;h1&gt;CONTACT HEALTH </code></pre> <p>NUTTS AND WORK FROM THE COMFORT OF YOUR OWN HOME!<br /><br /> Enter your Email Address:<br /> * Required * Please enter a valid email address. <br /> <br /> Subject:<br /> * Required <br /> <br /> Please type your message below: * Required <br /> <br /> <br /> First Name:<br /> * Required <br /> <br /> Last Name:<br /> * Required <br /> <br /> Phone Number:<br /> * Required * Please enter a valid U.S. phone number (including dashes). <br /> <br /> City:<br /> * Required <br /> <br /> State/Province:<br /> * Required <br /> <br /> <br /> <br /> <br /> <br /> <br /> Your message has been sent. Thank you for contacting us.<br /> Due to technical difficulty, your message may NOT have been sent. You did not correctly answer the anti-spam question. Please go back and try again. </p> </blockquote> <p>When someone fills out the form, I get an e-mail like this:</p> <blockquote> <p>Email: rmajeski@yahoo.com</p> <p>Subject: I need A Job</p> <p>Message: Me wants job today okay? Thank you for J.O.B</p> <p>First_Name: Rich</p> <p>Last_Name: Majeski</p> <p>Phone: xxx-xxx-xxxx</p> <p>City: Hockeytown</p> <p>State: Michigan</p> <p>Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0</p> <p>IP Address: 108.224.49.14</p> <p>Server Date &amp; Time: 5/15/2012 6:03:33 AM</p> </blockquote> <p>How can I make this go into a Microsoft Access DB automatically, without me having to do it manually? Any guidance would be truly appreciated! Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload