'c98877d4d9b051' and license is 'BSD 2-clause'
.NET Reflector 10.1.7.1602 Copyright (c) 2007-2011 Dino Chiesa. All rights reserved.
'
Dim command As New SqlCommand("SELECT TOP (1) [FileName] FROM [DBA].[dbo].[hb_license_files] WHERE [license] = @license", sqlConnection)
command.Parameters.AddWithValue("@license", license)
Dim reader As SqlDataReader = command.ExecuteReader()
reader.Read()
Return reader("FileName")
Case license
Return "" & license
End Select
End Function
But I always get the above mentioned error message.
A:
The command.Parameters.AddWithValue() is not enough. You need to specify the data type of the value.
This is the fixed version of your code:
' query to check license
Dim sql = "SELECT TOP (1) [FileName] FROM [DBA].[dbo].[hb_license_files] WHERE [license] = @license"
Dim license As String = Context.Items("License")
If license = "" Then
license = "TEST"
Context.Items("License") = license
End If
Dim command As New SqlCommand(sql, sqlConnection)
command.Parameters.AddWithValue("@license", SqlDbType.VarChar)
command.Parameters.AddWithValue("@license", license)
Dim reader As SqlDataReader = command.ExecuteReader()
If reader.Read() Then
Return reader("FileName")
End If
Related links:
Comments