+1-888-365-2779
Try Now
More in this section

Forums / Deployment / Sitefinity v2.5 DB Parameter Changes

Sitefinity v2.5 DB Parameter Changes

2 posts, 0 answered
  1. Jim Aderhold
    Jim Aderhold avatar
    48 posts
    Registered:
    29 Feb 2004
    14 Mar 2006
    Link to this post
    I have stumbled across a change in the Database class. With the addition of Oracle as a DB option, I guess there were changes made to the CreateParameter method in order to support the new DB. In the older version, you would pass in your IDbCommand, the parameter name in your sql statement with the "@" character as a prefix, and the parameter value. In the new version of the method, you must leave off the "@" character when passing in the parameter name.

    ex:
    string commandText = "Select * from table where Name = @Name";
    using
    (Database db = dbFactory.CreateDatabase())
    {

    IDbCommand command = db.NewCommand(commandText );
    db.CreateParameter(command, "@Name", "Name"); (Old Way)
    db.CreateParameter(command, "Name", "Name");
    (New Way)
    command.ExecuteNonQuery();
    }


    Although this is a minor change, it can cause some serious headaches when trying to use code written in v2.0 controls and trying to insert them into your v2.5 site. I hope this can help someone from hours of frustration when their controls won't work when upgrading to v2.5.
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    15 Mar 2006
    Link to this post
    You are right, Jim. We should have mentioned this change, which we made due to the Oracle support. Thank you for pointing this out.

    Your points were updated.


    Have a nice day,
    Vlad
    the telerik team
2 posts, 0 answered