Bug #37406 Warning message for VB.Net : "the datetime enum value is obsolete"
Submitted: 13 Jun 2008 23:28 Modified: 11 Jul 2008 15:48
Reporter: Charles Loh
Status: Closed
Category:Connector/Net Severity:S3 (Non-critical)
Version:5.1.6 OS:Microsoft Windows
Assigned to: Target Version:

[13 Jun 2008 23:28] Charles Loh
Description:
The MySqlDbType.DateTime is not available in VB.Net.  As such, the warning "the datetime
enum value is obsolete" is always shown during compilation.

How to repeat:
cmd.Parameters.Add("?dt", MySqlDbType.Datetime).Value = DateTime.Now
[13 Jun 2008 23:29] Charles Loh
Modified OS
[17 Jun 2008 15:10] Tonci Grgin
Hi Charles and thanks for your report.

Please take a minute to browse through c/NET changelog and you'll find this:
1. MySQL :: MySQL 5.1 Reference Manual :: C.3.17 Changes in MySQL Connector/NET 5.0.5 (07
March 2007)

    ... use of SchemaOnly or SingleRow command behaviors with stored procedures or
prepared statements. Added *MySqlParameterCollection.AddWithValue* and marked the
*Add(name, value) method as obsolete*. Return parameters created with DeriveParameters now
have the name 

This behavior is deliberate and documented so !Bg.

Example:
      MySqlCommand cmd = new MySqlCommand("fnTest", conn);
      cmd.CommandType = CommandType.StoredProcedure;

      //cmd.Parameters.Add("?valin", 22); << Obsolete
      cmd.Parameters.AddWithValue("?valin", 22); << Ok

      cmd.Parameters[0].DbType = DbType.Int32;
      cmd.Parameters[0].Direction = ParameterDirection.Input;
[17 Jun 2008 16:20] Charles Loh
Hi,
   I believe you have misunderstood my post.  The issue that was raised has absolutely
nothing to do with the reply you have provided.  

To clarify, i code in both VB.NET and C#.  Codes in C# were compiled without warnings. 
Only codes in VB.net were getting the warning.  

The issue is VB.net, being case-insensitive does not differentiate between
"MySqlDbType.Datetime" and "MySqlDbType.DateTime" (Note the casing difference between the
Date"T"ime)
[17 Jun 2008 17:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/48012
[17 Jun 2008 17:20] Reggie Burnett
Fixed in 5.1.7 and higher
[11 Jul 2008 15:48] Tony Bedford
An entry has been added to the 5.1.7 changelog:

As MySqlDbType.DateTime is not available in VB.Net the warning The datetime enum value is
obsolete was always shown during compilation.