Enterprise Library 2.0 ConfigureParameter does not like DataRowVersion.Default

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Guest

Enterprise Library 2.0 ConfigureParameter does not like DataRowVersion.Default

Post by Guest » Wed 01 Mar 2006 19:00

I get an InvalidOperationException exception whenever I try to use db.AddInParameter when the SourceVersion is not specified.

When not specified, it gets set to DataRowVersion.Default which gives an exception (see below).

Explicitly setting it to DataRowVersion.Current will work.

So I'm working around by
db.AddInParameter(dbCommand, "MyParameter", DbType.String, "", DataRowVersion.Current)
db.SetParameterValue(dbCommand, "MyParameter", "MyValue")




Full Exception is:
System.InvalidOperationException was unhandled by user code
Message="The DataRowVersion enumeration value, Default, is invalid."
Source="CoreLab.MySql"
StackTrace:
at CoreLab.Common.DbParameterBase.set_SourceVersion(DataRowVersion value)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ConfigureParameter(DbParameter param, String name, DbType dbType, Int32 size, ParameterDirection direction, Boolean nullable, Byte precision, Byte scale, String sourceColumn, DataRowVersion sourceVersion, Object value)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.CreateParameter(String name, DbType dbType, Int32 size, ParameterDirection direction, Boolean nullable, Byte precision, Byte scale, String sourceColumn, DataRowVersion sourceVersion, Object value)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.AddParameter(DbCommand command, String name, DbType dbType, Int32 size, ParameterDirection direction, Boolean nullable, Byte precision, Byte scale, String sourceColumn, DataRowVersion sourceVersion, Object value)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.AddParameter(DbCommand command, String name, DbType dbType, ParameterDirection direction, String sourceColumn, DataRowVersion sourceVersion, Object value)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.AddInParameter(DbCommand command, String name, DbType dbType, Object value)
at _Default.GetUserID(String UserName, String Password) in C:\Temp\MySQLTest\Default.aspx.vb:line 21
at _Default.Page_Load(Object sender, EventArgs e) in C:\Temp\MySQLTest\Default.aspx.vb:line 37
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

SecureGen
Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

DataRowVersion.Default

Post by SecureGen » Thu 02 Mar 2006 09:17

Please specify for what purpose would you like to use DataRowVersion.Default?

Guest

Post by Guest » Thu 02 Mar 2006 15:42

Actually, I don't want to use sourcecolumn and sourceversion, at all. But I have to set those parameters in order for MySQLDirect to complete the AddInParameter method. If it's not specified, then EntLib 2.0 uses DataRowVersion.Default as the sourceversion.

When I try the following code with the Ent Lib 2.0, I get the error.

db.AddInParameter(dbCommand, "MyParameter", DbType.String, "MyString")

When I debug the error, it's happening because the EntLib code is setting the sourceversion to DataRowVersion.Default if it's not specified. At this point, MySQLDirect.Net throws the invalid operation exception...

Thanks

David

SecureGen
Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Thu 02 Mar 2006 16:01

We cannot reproduce such behavior. Please make sure that db object has type MySqlDatabase. Does our demo project DataAccessQuickStart work properly in your system?

Guest

Post by Guest » Tue 07 Mar 2006 05:22

You were right - I had used the ent lib config tool and picked "CoreLab.MySQL" as the type.

I was able to get it working by actually following the directions in the documentation (imagine that :wink: ).

However, using the delivered CoreLab.EnterpriseLibrary.Data.MySql.dll and the example provider mapping in the documentation I was not able to get it working. The documentation shows

Code: Select all

      
    
The ent lib config tool produced the following:

Code: Select all

         
To get it working,
  • I compiled the CoreLab.EnterpriseLibrary.Data.MySql.dll
  • used the ent lib config to generate the provider mapping by loading the assembly
  • manually editted the web.config to use the provider name (you can't pick it from the list in the ent lib config tool.
Thanks for your help

SecureGen
Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Tue 07 Mar 2006 11:06

This is a documentation bug. It will be fixed in the next build.

Guest

Post by Guest » Thu 04 May 2006 13:21

SecureGen wrote:This is a documentation bug. It will be fixed in the next build.
Is the above documentation bug is fixed in Release 3.5?

December
Devart Team
Posts: 13
Joined: Thu 11 Nov 2004 08:02

Post by December » Fri 05 May 2006 08:37

Yes, it is fixed.

Post Reply