Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3439596
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:19:45+00:00 2026-05-18T08:19:45+00:00

According to MySql in this document C.7.9.6. Changes in MySQL Connector/NET 5.0.5 (07 March

  • 0

According to MySql in this document C.7.9.6. Changes in MySQL Connector/NET 5.0.5 (07 March 2007):

Added MySqlParameterCollection.AddWithValue and marked the Add(name, value) method as obsolete.

I’ve been using .Add up until recently and experienced no problems. Upon discovering the .AddWithValue method, it is preferable primarily because it involves less syntax.

My question: does anyone know if there is any functional difference between the two methods? I cannot find proper documentation on them.

Edit:

Microsoft makes this note about SqlParameterCollection:

AddWithValue replaces the
SqlParameterCollection.Add method that
takes a String and an Object. The
overload of Add that takes a string
and an object was deprecated because
of possible ambiguity with the
SqlParameterCollection.Add overload
that takes a String and a SqlDbType
enumeration value where passing an
integer with the string could be
interpreted as being either the
parameter value or the corresponding
SqlDbType value. Use AddWithValue
whenever you want to add a parameter
by specifying its name and value.

Perhaps it is for the same reason.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:19:46+00:00Added an answer on May 18, 2026 at 8:19 am

    When the documentation says nothing, consult the source.
    These methods are identical (in their implementation):

    /// <summary>
    /// Adds a <see cref="MySqlParameter"/> to the <see cref="MySqlParameterCollection"/> given the specified parameter name and value.
    /// </summary>
    /// <param name="parameterName">The name of the parameter.</param>
    /// <param name="value">The <see cref="MySqlParameter.Value"/> of the <see cref="MySqlParameter"/> to add to the collection.</param>
    /// <returns>The newly added <see cref="MySqlParameter"/> object.</returns>
    [Obsolete("Add(String parameterName, Object value) has been deprecated.  Use AddWithValue(String parameterName, Object value)")]
    public MySqlParameter Add(string parameterName, object value)
    {
        return Add(new MySqlParameter(parameterName, value));
    }
    
    public MySqlParameter AddWithValue(string parameterName, object value)
    {
        return Add(new MySqlParameter(parameterName, value));
    }
    

    http://mysql-connector-net-5.0.sourcearchive.com/documentation/5.0.8.1/parameter__collection_8cs-source.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

according to this article: http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/ using ORDER BY RAND() is a bad idea because:
According to mysql document Encoding with a 128-bit key length is used, but you
According to this question on how to set the time_zone in mysql and this
According to the MySQL Certification Guide, when --tab option is used, a SELECT ...
I'm trying to generate a top ten list of locations according to my MySQL
MYSQL I want to filter "orders" according to their items within a form's checkboxes.
According to this SO post: How to check the TEMPLATE_DEBUG flag in a django
According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
My scripts are definitely saved in UTF-8. I'm instantiating PDO with {$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8 . My
According to the MySQL documentation regarding Optimizing Queries With Explain : * ALL: A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.