Not sure what I am doing wrong here because I thought I was adding the parameter Guid to the collection?
Code:
Protected Sub btnRegister_Click(sender As Object, e As System.EventArgs) Handles btnRegister.Click
Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("xforafricaConnectionString").ConnectionString
Dim con As New SqlConnection(ConnString)
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "AddNewRegistration"
cmd.Parameters.Add("@Firstname", SqlDbType.VarChar).Value = txtFirstname.Text.Trim()
cmd.Parameters.Add("@Surname", SqlDbType.VarChar).Value = txtSurname.Text.Trim()
cmd.Parameters.Add("@Company", SqlDbType.VarChar).Value = txtCompany.Text.Trim()
cmd.Parameters.Add("@EmailAddress", SqlDbType.NVarChar).Value = txtEmail.Text.Trim()
cmd.Parameters.Add("@Password", SqlDbType.NVarChar).Value = txtPassword.Text.Trim()
cmd.Parameters.Add("@Guid", SqlDbType.UniqueIdentifier).Direction = ParameterDirection.Output
cmd.Connection = con
Try
con.Open()
cmd.ExecuteScalar()
Dim Guid As String
Guid = DirectCast(cmd.Parameters("@Guid ").Value, String)
Response.Write(Guid)
Catch ex As Exception
Throw ex
Finally
con.Close()
con.Dispose()
End Try
'send_email()
'RegForm.Visible = False
' RegSuccess.Visible = True
' Response.AddHeader("Refresh", "3;URL=index.aspx")
End Sub