473,388 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

'System.Data.SqlDbType' cannot be converted

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.

Nov 21 '05 #1
1 3059
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

"patrick" <pa*****@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
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.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
11
by: Vinod I | last post by:
Hi Team, I am having a string as "System.Data.SqlDbType.Int". Now I want to convert this string type to actual type to use with my Command object Parameter Creation. How I will convert this...
2
by: adams114 | last post by:
I am having a strange problem with invalid type casts. I am trying to update a MS SQL Database with a stored procedure. When I setup the parameters collection for the command object I get a invalid...
2
by: Patrick Olurotimi Ige | last post by:
I converted the code below from VB.NET to C# cos i have to add it to a C# application!! But i'm getting the error:- System.Data.SqlClient.SqlCommand.Parameters' denotes a 'property' where a...
1
by: Hifni Shahzard | last post by:
Hi, I got a stored procedure, where it returns a value. But if I execute it. It gives an error as "Invalid cast from System.Int32 to System.Byte.". To make clear how do I execute this, below I'm...
3
by: Stacey Levine | last post by:
I have a webservice that has the below procedure. Basically a procedure to called a stored procedure and return the results. When I try to call the webservice from my program I get the error. Both...
3
by: c676228 | last post by:
Hi all, I think I have data type problem when I tried to insert data into sql server 200. The erroe message is like this: system.invalidcastexception data type DFlage char(1) in sql 2000, DMI...
1
by: thithi | last post by:
Please help me " System.Data.SqlClient.SqlException: Prepared statement '(@Name varchar(100),@Describes varchar(100),@Money char(10))Upda' expects parameter @Describes, which was not supplied. at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.