Error in web.config file and dataaccess

hi Experts,

                I am using, C# , SQL SERVER. In my web.config file I am using ProviderName= "System.Data.SqlClient", but in my data access i am using dbProvider, when i execute i got the error. I have attached screen shot for your review. I guess the error is in between web.config and my dataAccess. Please let me know.


    <add name="BalloonShopConnection" connectionString="server=TAPAN-PC;Database=BallonShop;User=ballonshop;Password=ecommerce" ProviderName="System.Data.SqlClient"/>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Common;

/// <summary>
/// Class contains generic data access functionality to be accessed from the businesstier
/// </summary>
public static class GenericDataAccess
    //static constructor
    static GenericDataAccess()

    //Execute a command and returns the results as a dataTable object
    public static DataTable ExecuteSelectCommand(DbCommand command )
        //The DataTable to be returned

        DataTable table;

        // Execute the command,making sure the connection gets closed in the end
            //Open the data connection
            //Execute the command and save the results in a DataTable
            DbDataReader reader = command.ExecuteReader();

            table = new DataTable();

            //Close the connection
        catch (Exception ex)
            //close the connection
        return table;

    //Create and prepares a new Dbcommand object on a new connection

    public static DbCommand CreateCommand()
        //obtain the database provider name;

        string dataProviderName = BalloonShopConfiguration.DbProviderName;

        //Obtain the database connection string
        string connectionString = BalloonShopConfiguration.DbConnectionString;
        //Create a new data Provider Factroy
        DbProviderFactory factory= DbProviderFactories.GetFactory(dataProviderName);

        // Obtain a database-specific connection object
        DbConnection conn = factory.CreateConnection();

        //set the connection string
        conn.ConnectionString = connectionString;

        //create a database specific command object
        DbCommand comm = conn.CreateCommand();

        // Set the command type to stored procecures
        comm.CommandType = CommandType.StoredProcedure;

        //Return the initialized command object
        return comm;


LVL 22
Tapan PattanaikSenior EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:

What is the exact error displayed if you inspect ex.Message, ex.Source, and ex.StackTrace?  Can you provide that information?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tapan PattanaikSenior EngineerAuthor Commented:
When i build the solution (F6). it tells  build succeed, but when i press F5 ,it redirects to the  "App_Code\GenericDataAccess.cs" file. Screen shot of  which i was attached previously and i was also posted full code of that page  in my question.

In the web browser i have seen this error. which i have attached screen shot below for your review.

<if you want to check my ConnectionString , you can check in my question which i have posted first.>

tapan Pattanaik.
Tapan PattanaikSenior EngineerAuthor Commented:
Please check the exact error message.

Tapan PattanaikSenior EngineerAuthor Commented:
From StackTrace i found  the error was in connection string. I was writing wrong " ProviderName" instead of "providerName".

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.