I am trying to update a field in a table using a uniqueidentifier field as a parameter.
Here is my stored procedure
Here is my asp.net code
Basically when a user registers they are sent an email with a link which contains a querystring with the uniqueidentifier from the table. when they click on the link it takes them to the activation page and it should update the database verified field to true using the querystring.
Here is my stored procedure
Code:
USE [xforafrica]
GO
/****** Object: StoredProcedure [dbo].[UpdateVerified] Script Date: 09/02/2012 22:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[UpdateVerified]
(
@Guid uniqueidentifier
)
AS
BEGIN
SET NOCOUNT ON;
UPDATE dbo.Registrations
SET Verified = 1
WHERE Guid = @Guid
END
Here is my asp.net code
Code:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("xforafricaConnectionString").ConnectionString
Dim con As New SqlConnection(ConnString)
Dim cmd As New SqlCommand()
Dim guid As String = Request.QueryString("guid").ToString()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "UpdateVerified"
cmd.Parameters.Add("@Guid", SqlDbType.UniqueIdentifier).Value = guid
cmd.Connection = con
Try
con.Open()
cmd.ExecuteScalar()
Catch ex As Exception
Throw ex
Finally
con.Close()
con.Dispose()
End Try
End Sub
Basically when a user registers they are sent an email with a link which contains a querystring with the uniqueidentifier from the table. when they click on the link it takes them to the activation page and it should update the database verified field to true using the querystring.