Sending email... incorrect value(parameter) comes back

J

JJ297

The user selects an item from the gridview which takes them to
checkoutitem.aspx (this works well)

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Response.Redirect("checkoutItem.aspx?TitleID=" &
GridView1.SelectedValue)

End Sub

I'm able to fill out the form then the email is sent. I get the email
but the correct titleid is not there.

Protected Sub Submit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Submit.Click

Dim PhoneNum As String = PhNoTxt.Text

Dim Job As String = JobTxt.Text

Dim StreetAddress1 As String = Street1Txt.Text

Dim StreetAddress2 As String = Street2Txt.Text

Dim City As String = CityTxt.Text

Dim State As String = StateTxt.Text

Dim Zip As String = ZipcodeTxt.Text

Dim ZipPlus As String = ZipPlusTxt.Text

Dim conn As New
Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("TrainUserConnectionString").ConnectionString)

Dim cmd As New Data.SqlClient.SqlCommand

With cmd

..Connection = conn 'the connection

..CommandType = Data.CommandType.StoredProcedure

..CommandText = "AddLoanRequest"

..Parameters.AddWithValue("@RequestorEmail", EmailAdd.Text)

..Parameters.AddWithValue("@RequestDate", LoanDate.Text)

..Parameters.AddWithValue("@FName", FName.Text)

..Parameters.AddWithValue("@LName", LName.Text)

..Parameters.AddWithValue("@PhoneNum", PhNoTxt.Text)

..Parameters.AddWithValue("@JobTitleID", JobTxt.Text)

..Parameters.AddWithValue("@StreetAddress1", Street1Txt.Text)

..Parameters.AddWithValue("@StreetAddress2", Street2Txt.Text)

..Parameters.AddWithValue("@City", CityTxt.Text)

..Parameters.AddWithValue("@State", StateTxt.Text)

..Parameters.AddWithValue("@Zip", ZipcodeTxt.Text)

..Parameters.AddWithValue("@ZipPlus4", ZipPlusTxt.Text)


End With

'Try

conn.Open()

Dim x As Integer

x = cmd.ExecuteNonQuery

Dim ocdoEmail As New Object

ocdoEmail = Server.CreateObject("CDO.Message")

ocdoEmail.To = Session("GetEmail")

ocdoEmail.From = Session("GetEmail")

'ocdoEmail.CC

ocdoEmail.Subject = "Training Library Request"

ocdoEmail.HTMLBody = "<a href=""http://phapps.ph.ad.ssa.gov/
traininglibrary/Fillrequest.aspx?TitleID=" & x & """>Click to view </
a>"

ocdoEmail.send()


conn.Close()

End Sub


Here's the stored procedure AddLoanRequest

CREATE procedure AddLoanRequest
@RequestorEmail varchar (75),
@RequestDate datetime,
@Fname varchar (50),
@Lname varchar (50),
@PhoneNum char (10),
@JobTitleID int,
@StreetAddress1 varchar (50),
@StreetAddress2 varchar (50),
@City varchar (50),
@State char (2),
@Zip char (5),
@ZipPlus4 char (4)
AS

set NOCOUNT on
declare @TitleID int

insert into Requestors(RequestorEmail, Titleid,RequestDate,
Fname,Lname,PhoneNum,JobTitleId,StreetAddress1,StreetAddress2,City,State,Zip,ZipPlus4)
values(@RequestorEmail,
@Titleid,
@RequestDate,
@Fname,
@Lname,
@PhoneNum,
@JobTitleID,
@StreetAddress1,
@StreetAddress2,
@City,
@State,
@Zip,
@ZipPlus4)
set @titleid = SCOPE_IDENTITY() --grabbing the id

select @titleid as titleid --return to caller for email

GO




Is the ocdoEmail.HTMLBody correct? Do I need to put something on
Fillrequest.aspx?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top