You're trying to compare a string from the database (the
page_content
field) to the integer value
1
. VB.NET is automatically trying to convert that string to a number for you.
But as you can see from the error, that column does not contain a number. It contains the string:
0</title><style>.ascx{display:bl
The quick fix to get the site back up is to change your code so that it compares the string column to a string:
If dr("page_external_link") IsNot DBNull.Value AndAlso dr("page_external_link") AndAlso dr("page_content") = "1" Then
Then you'll need to fix your data, as it clearly has unexpected and invalid values in the
page_content
column. You'll also want to try to work out where that value came from, and add validation to prevent it from coming back.
If the column is only meant to contain integers, change the data type to
int
.