I have a webform with a DetailsView where users can request badges for up to 5 visitors. Only one is required.
I need to create a database record (SQL 2005) and send an email based on user input.
The problem comes when there is only one name entered.
Then, for example, the visitorName2 is null. It's no problem for the database part of things
For the email message, however, I don't want to include any names that are left blank.
This is where I have trouble. I'm using the inserting event of the sqldatasource to check the value in the detailsview
If the value is not null, I want to append it to the email message. If it's null, then do nothing.
I thought maybe if I defined an Object variable, that might work, but it didn't
Here is the code that doesn't work:
objValue = e.Command.Parameters("@visitorName2").Value
If objValue IsNot DBNull.Value Then
EMailBodyStringBuilder.Append("Visitor 2: " & e.Command.Parameters ("@visitorName2").Value.ToString)
Any help would be appreciated.