'System.Data.SqlDbType' cannot be converted

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have tried using 2 type systems to get this to compile but it still gets
the same error:

Public MustInherit Class _Applications
Private _AppID As System.Decimal
Private _AppPosition As System.Decimal
Private _AppCompany As System.Decimal
Private _AppWhen As System.DateTime
Private _AppType As System.String
Private _AppNotes As System.String
Private _RowVersion As System.Byte()
Private _isNew As Boolean

#Region " Constructors "
Public Sub New()
_AppID = SqlDbType.Decimal
* _AppWhen = SqlDbType.SmallDateTime (this line)
_AppType = SqlDbType.VarChar
_AppNotes = SqlDbType.VarChar
* _RowVersion = SqlDbType.Timestamp (and this line)
End Sub
.....
end Class

ERROR:
_Applications.vb(50): Value of type 'System.Data.SqlDbType' cannot be
converted to 'Date'.

In the SQL Server database they are both smalldatetime fields.
 
Hi,
_AppWhen is declared as a date,
_AppWhen = SqlDbType.SmallDateTime is trying to assign an integer ( the
enum 'SmallDateTime') to the date.
If you try _AppWhen = 15 (The 'value' of SmallDateTime) you will get the
same error.
Hope this helps
regards
Bob
 
Back
Top