'System.Data.SqlDbType' cannot be converted

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.
 
B

Bob

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top