J
JJ297
I have a generated email going to another person after they submit a
question. When you click on the email sent to the user it's not
getting the question ID. What am I doing wrong?
Here's the code behind page:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim question As String = Txtquestion.Text
Dim conn As New Data.SqlClient.SqlConnection("Data
Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
Info=True;User ID=EDCSFAQUser;Password=fax") 'this is the conn from
frontpage
Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn 'the connection
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddQuestion"
.Parameters.AddWithValue("@topicid",
CInt(DropDownList1.SelectedItem.Value))
.Parameters.AddWithValue("@quesdate", QuesDate.Text)
.Parameters.AddWithValue("@questions", Txtquestion.Text)
.Parameters.AddWithValue("@FName", FName.Text)
.Parameters.AddWithValue("@LName", LName.Text)
.Parameters.AddWithValue("@EmailAdd", EmailAdd.Text)
End With
conn.Open()
Dim x As Integer
x = cmd.ExecuteScalar 'will bring back my quesID for the email
lbloutcome.Text = "Your entry was submitted into the
database."
Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
cdpadminEditpage.aspx?quesid=" & x & """> Click to view question that
was submitted.</a>"
ocdoEmail.send()
conn.Close()
End Sub
Here's the stored procedure I'm using.
CREATE procedure AddQuestion
@quesdate datetime,
@topicid int,
@questions varchar(1000) ,
@fname varchar (50),
@lname varchar (50),
@emailadd varchar (250)
AS
Set NOCOUNT ON
declare @quesid int
INSERT INTO QuesNAns(quesdate,topicid, questions)
values(@quesdate,
@topicid,
@questions)
set @quesid = SCOPE_IDENTITY()
INSERT INTO Requesters(quesid,fname,lname,emailadd)
values(@quesid,
@fname,
@lname,
@emailadd)
return @quesid
GO
question. When you click on the email sent to the user it's not
getting the question ID. What am I doing wrong?
Here's the code behind page:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim question As String = Txtquestion.Text
Dim conn As New Data.SqlClient.SqlConnection("Data
Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
Info=True;User ID=EDCSFAQUser;Password=fax") 'this is the conn from
frontpage
Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn 'the connection
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddQuestion"
.Parameters.AddWithValue("@topicid",
CInt(DropDownList1.SelectedItem.Value))
.Parameters.AddWithValue("@quesdate", QuesDate.Text)
.Parameters.AddWithValue("@questions", Txtquestion.Text)
.Parameters.AddWithValue("@FName", FName.Text)
.Parameters.AddWithValue("@LName", LName.Text)
.Parameters.AddWithValue("@EmailAdd", EmailAdd.Text)
End With
conn.Open()
Dim x As Integer
x = cmd.ExecuteScalar 'will bring back my quesID for the email
lbloutcome.Text = "Your entry was submitted into the
database."
Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
cdpadminEditpage.aspx?quesid=" & x & """> Click to view question that
was submitted.</a>"
ocdoEmail.send()
conn.Close()
End Sub
Here's the stored procedure I'm using.
CREATE procedure AddQuestion
@quesdate datetime,
@topicid int,
@questions varchar(1000) ,
@fname varchar (50),
@lname varchar (50),
@emailadd varchar (250)
AS
Set NOCOUNT ON
declare @quesid int
INSERT INTO QuesNAns(quesdate,topicid, questions)
values(@quesdate,
@topicid,
@questions)
set @quesid = SCOPE_IDENTITY()
INSERT INTO Requesters(quesid,fname,lname,emailadd)
values(@quesid,
@fname,
@lname,
@emailadd)
return @quesid
GO