I have
strSQL = "DECLARE @Inserted_Key int INSERT INTO tblIncident (IncDesc, IncDate, StatusID, ClientID, ISStaffID) Values ('" & Replace(Problem.Text, "'", "''") & "', GetDate(),1," & strID & ",5) SET @Inserted_Key = @@Identity"
from samples and info that i found,
how can i get the @inserted_key into a local variable to use in a generated email?
.....
objConnection = New SqlConnection("Data Source=localhost;" _
& "Initial Catalog=mydb;integrated security=SSPI;" _
& "Connect Timeout=15;Network Library=dbmssocn;")
Dim objComm As New SqlCommand(strSQL)
objComm.Connection = objConnection
objConnection.Open()
objComm.ExecuteNonQuery()
objComm.Connection.Close()
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Dim message
mailMessage.From = "meme@meme.com"
mailMessage.To = "yoyo@yoyo.com"
mailMessage.CC = dgClients.Items(0).Cells(3).Text
mailMessage.Subject = "A Help Request Has Been Submitted"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
message = "Name: " & Employees.SelectedItem.Text & vbNewLine & vbNewLine _
& "Ext: " & dgClients.Items(0).Cells(0).Text & vbNewLine _
& "Location: " & dgClients.Items(0).Cells(1).Text & vbNewLine _
& "Computer: " & dgClients.Items(0).Cells(2).Text & vbNewLine & vbNewLine _
& "Problem: " & Problem.Text & vbNewLine & vbNewLine _
& "Ticket #: " & newIncNum
& "From IP: " & Request.ServerVariables("REMOTE_HOST")
mailmessage.body = message
System.Web.Mail.SmtpMail.SmtpServer = "mymailserver"
System.Web.Mail.SmtpMail.Send(mailMessage)
strSQL = "DECLARE @Inserted_Key int INSERT INTO tblIncident (IncDesc, IncDate, StatusID, ClientID, ISStaffID) Values ('" & Replace(Problem.Text, "'", "''") & "', GetDate(),1," & strID & ",5) SET @Inserted_Key = @@Identity"
from samples and info that i found,
how can i get the @inserted_key into a local variable to use in a generated email?
.....
objConnection = New SqlConnection("Data Source=localhost;" _
& "Initial Catalog=mydb;integrated security=SSPI;" _
& "Connect Timeout=15;Network Library=dbmssocn;")
Dim objComm As New SqlCommand(strSQL)
objComm.Connection = objConnection
objConnection.Open()
objComm.ExecuteNonQuery()
objComm.Connection.Close()
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Dim message
mailMessage.From = "meme@meme.com"
mailMessage.To = "yoyo@yoyo.com"
mailMessage.CC = dgClients.Items(0).Cells(3).Text
mailMessage.Subject = "A Help Request Has Been Submitted"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
message = "Name: " & Employees.SelectedItem.Text & vbNewLine & vbNewLine _
& "Ext: " & dgClients.Items(0).Cells(0).Text & vbNewLine _
& "Location: " & dgClients.Items(0).Cells(1).Text & vbNewLine _
& "Computer: " & dgClients.Items(0).Cells(2).Text & vbNewLine & vbNewLine _
& "Problem: " & Problem.Text & vbNewLine & vbNewLine _
& "Ticket #: " & newIncNum
& "From IP: " & Request.ServerVariables("REMOTE_HOST")
mailmessage.body = message
System.Web.Mail.SmtpMail.SmtpServer = "mymailserver"
System.Web.Mail.SmtpMail.Send(mailMessage)