none
SQL code connection error

    Question

  • Hi,

    I am using Entity framework in my ASP web application. but during running the page , I am getting this error:

    An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.

    my myconfig connection is:/

    <

    connectionStrings>

     

        <

    addname="SAMConnection_New"connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SAM.mdf;Integrated Security=True"providerName="System.Data.SqlClient"  />

      </

    connectionStrings>

    Kindly help me out.. Thanks in advance.

     
    Sunday, August 25, 2013 6:49 PM

Answers

  • I am using Entity framework in my ASP web application. but during running the page , I am getting this error:

    An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.

    my myconfig connection is:/

    <

    connectionStrings>

     

        <

    addname="SAMConnection_New"connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SAM.mdf;Integrated Security=True"providerName="System.Data.SqlClient"  />

      </

     

    The error message indicates that you are using an OLE DB connection but the actual connection string is SqlClient.  I don't think EF supports OLE DB directly (there may be 3rd party EF providers that do) so I'm not sure why it is trying to use an OLE DB here.  Perhaps there is something amiss with the EF configuration or your code that is referencing OLE DB.


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com


    Sunday, August 25, 2013 8:23 PM
    Moderator
  • Hello,

    If I have not going wrong, System.Data.SqlClient is not corresponding to OLEDB

    See http://www.connectionstrings.com/sqlconnection/

    http://www.connectionstrings.com/sql-server-native-client-9-0-oledb-provider/

    The provider should be SQLNCLI11 and not SQLOLEDB.

    Please, could tell us versus version of SQL Server are you trying to connect ( 2000, 2005 , 2008 , 2008 R2 , 2012 ) ?

    I suppose that you are trying to connect versus a LocalDB database ( version 2012 )

    See http://www.connectionstrings.com/sql-native-client-use/

    http://www.connectionstrings.com/sql-server-2012/

    OLEDB is depreciated

    As LocalDB is a specific to the Express Edition of SQL Server , I would suggest to have a look at

    http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

    http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx

    and more generally http://blogs.msdn.com/b/sqlexpress/ ( an excellent blog from the SQL Server Express team who has created the LocalDB feature )

    If you post your agreement , a moderator will move ASAP your thread towards the SQL Server Express forum where this kind of problem is usually ( I am preferring to wait for the agreement of the original poster before doing this move ). A move avoids you to recreate your thread and to let this thread dying in an "incorrect" forum.

    Are you sure to want to use OLEDB as it is a depreciated provider which should disappear maybe before 2016 ?

    We are waiting for your feedback to try to help you more efficiently.

    Have a nice day

    PS : I would suggest you to have a look at the articles from Krzystof about LocalDB in the blog I gave you the link. They are easy to understand and written by the man who was managing the SQL Server Express Team.


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.


    Sunday, August 25, 2013 8:34 PM
    Moderator

All replies

  • I am using Entity framework in my ASP web application. but during running the page , I am getting this error:

    An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.

    my myconfig connection is:/

    <

    connectionStrings>

     

        <

    addname="SAMConnection_New"connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SAM.mdf;Integrated Security=True"providerName="System.Data.SqlClient"  />

      </

     

    The error message indicates that you are using an OLE DB connection but the actual connection string is SqlClient.  I don't think EF supports OLE DB directly (there may be 3rd party EF providers that do) so I'm not sure why it is trying to use an OLE DB here.  Perhaps there is something amiss with the EF configuration or your code that is referencing OLE DB.


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com


    Sunday, August 25, 2013 8:23 PM
    Moderator
  • Hello,

    If I have not going wrong, System.Data.SqlClient is not corresponding to OLEDB

    See http://www.connectionstrings.com/sqlconnection/

    http://www.connectionstrings.com/sql-server-native-client-9-0-oledb-provider/

    The provider should be SQLNCLI11 and not SQLOLEDB.

    Please, could tell us versus version of SQL Server are you trying to connect ( 2000, 2005 , 2008 , 2008 R2 , 2012 ) ?

    I suppose that you are trying to connect versus a LocalDB database ( version 2012 )

    See http://www.connectionstrings.com/sql-native-client-use/

    http://www.connectionstrings.com/sql-server-2012/

    OLEDB is depreciated

    As LocalDB is a specific to the Express Edition of SQL Server , I would suggest to have a look at

    http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

    http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx

    and more generally http://blogs.msdn.com/b/sqlexpress/ ( an excellent blog from the SQL Server Express team who has created the LocalDB feature )

    If you post your agreement , a moderator will move ASAP your thread towards the SQL Server Express forum where this kind of problem is usually ( I am preferring to wait for the agreement of the original poster before doing this move ). A move avoids you to recreate your thread and to let this thread dying in an "incorrect" forum.

    Are you sure to want to use OLEDB as it is a depreciated provider which should disappear maybe before 2016 ?

    We are waiting for your feedback to try to help you more efficiently.

    Have a nice day

    PS : I would suggest you to have a look at the articles from Krzystof about LocalDB in the blog I gave you the link. They are easy to understand and written by the man who was managing the SQL Server Express Team.


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.


    Sunday, August 25, 2013 8:34 PM
    Moderator