T
todd
I am making a new website with an mssql express database. i have some text
boxes and checkboxes on a page. I need them to be inserted into the sql
table when the finsh button is clicked. i have the database connection
string in the web.config file. Some of the textboxes id is txtname,
txtaddress, txtemail and checkbox id checktext1.
The Private Sub Requestdata() is where i was looking to put the code for the
insert and then call it from the finishbutton_click
VB code i have so far:
Imports System.Net.Mail
Partial Class Econ_Request
Inherits System.Web.UI.Page
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
Wizard1.FinishButtonClick
SendMail()
Requestdata()
End Sub
Private Sub Requestdata()
End Sub
Private Sub SendMail()
Dim mailMessage As New MailMessage
mailMessage.From = New MailAddress("(e-mail address removed)")
mailMessage.To.Add(New MailAddress("(e-mail address removed)"))
mailMessage.Subject = "Request Inforamtion"
mailMessage.Body = "Check Web For New Request Inforamtion."
Dim smtpclient As New SmtpClient()
Dim userState As Object = mailMessage
AddHandler smtpclient.SendCompleted, AddressOf smtpclient_onCompleted
smtpclient.SendAsync(mailMessage, userState)
End Sub
Public Sub SmtpClient_OnCompleted(ByVal Sender As Object, ByVal e As
System.ComponentModel.AsyncCompletedEventArgs)
Dim mailMessage As MailMessage
mailMessage = CType(e.UserState, MailMessage)
If (e.Cancelled) Then
LabelMessage.Text = "Sending Of Email Message was Cancelled.
Address=" + mailMessage.To(0).Address
End If
If Not (e.Error Is Nothing) Then
LabelMessage.Text = "Error occured, info=" + e.Error.Message
Else
LabelMessage.Text = "Your Request Was Sent Successfully."
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub
Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
Wizard1.NextButtonClick
SumName.Text = "Attn: " + txtName.Text
If Check1.Checked Then
SumCap.Text = "text"
Else
SumCap.Text = ""
End If
If Check2.Checked Then
Sumtext2.Text = "text2"
Else
Sumtext2.Text = ""
End If
If Checktext3.Checked Then
Sumtext3.Text = "text3"
Else
Sumtext3.Text = ""
End If
If Checktext4.Checked Then
Sumtext4.Text = "text4"
Else
Sumtext4.Text = ""
End If
If Checktext5.Checked Then
Sumtext5.Text = "text5"
Else
Sumtext5.Text = ""
End If
If Checktext6.Checked Then
Sumtext6.Text = "text6"
Else
Sumtext6.Text = ""
End If
If Checktext7.Checked Then
Sumtext7.Text = "text7"
Else
Sumtext7.Text = ""
End If
If Checktext8.Checked Then
Sumtext8.Text = "text8"
Else
Sumtext8.Text = ""
End If
If Checktext9.Checked Then
Sumtext9.Text = "text9"
Else
Sumtext9.Text = ""
End If
If Checktext10.Checked Then
Sumtext10.Text = "text10"
Else
Sumtext10.Text = ""
End If
If Checktext11.Checked Then
Sumtext11.Text = "text11"
Else
Sumtext11.Text = ""
End If
If Checktext12.Checked Then
Sumtext12.Text = "text12"
Else
Sumtext12.Text = ""
End If
If check13.Checked Then
Sumcheck13.Text = "Test " + txtPhone.Text + " or " + txtEmail.Text
SumAddress.Text = ""
SumCity.Text = ""
Else
Sumcheck13.Text = "TEST@ "
SumAddress.Text = txtAddress.Text
SumCity.Text = txtCity.Text + ", " + txtState.Text + " " +
txtZip.Text
End If
End Sub
End Class
I am not sure what the code is to insert into a table.
thank for any help you can give me
Todd
boxes and checkboxes on a page. I need them to be inserted into the sql
table when the finsh button is clicked. i have the database connection
string in the web.config file. Some of the textboxes id is txtname,
txtaddress, txtemail and checkbox id checktext1.
The Private Sub Requestdata() is where i was looking to put the code for the
insert and then call it from the finishbutton_click
VB code i have so far:
Imports System.Net.Mail
Partial Class Econ_Request
Inherits System.Web.UI.Page
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
Wizard1.FinishButtonClick
SendMail()
Requestdata()
End Sub
Private Sub Requestdata()
End Sub
Private Sub SendMail()
Dim mailMessage As New MailMessage
mailMessage.From = New MailAddress("(e-mail address removed)")
mailMessage.To.Add(New MailAddress("(e-mail address removed)"))
mailMessage.Subject = "Request Inforamtion"
mailMessage.Body = "Check Web For New Request Inforamtion."
Dim smtpclient As New SmtpClient()
Dim userState As Object = mailMessage
AddHandler smtpclient.SendCompleted, AddressOf smtpclient_onCompleted
smtpclient.SendAsync(mailMessage, userState)
End Sub
Public Sub SmtpClient_OnCompleted(ByVal Sender As Object, ByVal e As
System.ComponentModel.AsyncCompletedEventArgs)
Dim mailMessage As MailMessage
mailMessage = CType(e.UserState, MailMessage)
If (e.Cancelled) Then
LabelMessage.Text = "Sending Of Email Message was Cancelled.
Address=" + mailMessage.To(0).Address
End If
If Not (e.Error Is Nothing) Then
LabelMessage.Text = "Error occured, info=" + e.Error.Message
Else
LabelMessage.Text = "Your Request Was Sent Successfully."
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub
Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.WizardNavigationEventArgs) Handles
Wizard1.NextButtonClick
SumName.Text = "Attn: " + txtName.Text
If Check1.Checked Then
SumCap.Text = "text"
Else
SumCap.Text = ""
End If
If Check2.Checked Then
Sumtext2.Text = "text2"
Else
Sumtext2.Text = ""
End If
If Checktext3.Checked Then
Sumtext3.Text = "text3"
Else
Sumtext3.Text = ""
End If
If Checktext4.Checked Then
Sumtext4.Text = "text4"
Else
Sumtext4.Text = ""
End If
If Checktext5.Checked Then
Sumtext5.Text = "text5"
Else
Sumtext5.Text = ""
End If
If Checktext6.Checked Then
Sumtext6.Text = "text6"
Else
Sumtext6.Text = ""
End If
If Checktext7.Checked Then
Sumtext7.Text = "text7"
Else
Sumtext7.Text = ""
End If
If Checktext8.Checked Then
Sumtext8.Text = "text8"
Else
Sumtext8.Text = ""
End If
If Checktext9.Checked Then
Sumtext9.Text = "text9"
Else
Sumtext9.Text = ""
End If
If Checktext10.Checked Then
Sumtext10.Text = "text10"
Else
Sumtext10.Text = ""
End If
If Checktext11.Checked Then
Sumtext11.Text = "text11"
Else
Sumtext11.Text = ""
End If
If Checktext12.Checked Then
Sumtext12.Text = "text12"
Else
Sumtext12.Text = ""
End If
If check13.Checked Then
Sumcheck13.Text = "Test " + txtPhone.Text + " or " + txtEmail.Text
SumAddress.Text = ""
SumCity.Text = ""
Else
Sumcheck13.Text = "TEST@ "
SumAddress.Text = txtAddress.Text
SumCity.Text = txtCity.Text + ", " + txtState.Text + " " +
txtZip.Text
End If
End Sub
End Class
I am not sure what the code is to insert into a table.
thank for any help you can give me
Todd