SQL Server 2005 Express connection error?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



When I run the code below in Visual Web Developer 2005 Express, I'm
getting an "Unable to find the requested .Net Framework Data Provider.
It may not be installed." error. I've been researching a fix for the
past two days without any luck. I've tried completely uninstalling
both VWD and SQL Server 2005 Express and reinstalling. I've checked
for capitalization and typos (code compiles fine). I've also looked at
the machine.config file, although I really don't know what I'm looking
for to be honest. There are lines in there for
"System.Data.SQLClient," although they don't use the same
capitalization.

Anyone out there seen this issue before and have a fix? If not, can
someone enlighten me as to how to troubleshoot it? I'm just beginning
in C# and SQL Server, so any info would be greatly appreciated.

Anyway, here's the code that's throwing the error. It's the
"DbProviderFactory factory =
DbProviderFactories.GetFactory(dataProviderName);" line.

public static DbCommand CreateCommand()
{
//Obtain the database provider name
string dataProviderName =
MyProjectConfiguration.DbProviderName;
//Obtain the database connection string
string connectionString =
MyProjectConfiguration.DbConnectionString;
//Create a new data provider factory
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 procedure
comm.CommandType = CommandType.StoredProcedure;
//Return the initialized command object
return comm;
}

-Josh Nikle

.



Relevant Pages

  • Re: [SOLVED] Cannot display provider-specific login prompt
    ... scenario where the program wouldn't have to know about the database, ... ConnectionStringBuilder up to a PropertyGrid for the end user to populate), ... details of the connection, for the sake of the program being able to connect ... information about the connection string that I will need. ...
    (microsoft.public.dotnet.framework.adonet)
  • Complicated Connection Problems bewteen ADP and SQL Server
    ... This database ... expertise for getting the user workstations talking to the SQL Server. ... connection would fail and the adp wouldn't be able to talk to the server. ... might be in my ADO connection string. ...
    (microsoft.public.access.adp.sqlserver)
  • Complicated Connection Problem between ADP and SQL Server
    ... This database ... expertise for getting the user workstations talking to the SQL Server. ... connection would fail and the adp wouldn't be able to talk to the server. ... might be in my ADO connection string. ...
    (microsoft.public.sqlserver.connect)
  • Re: Problems in loading data from an access database into an array
    ... Suppose your database has a table called which has columns called ... Dim oleCSB As New OleDbConnectionStringBuilder ... 'associate the connection string just built with the ole connection ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Syntax
    ... The connection string format is not valid. ... connection string with zero components is set on database connection manager. ... Access database connection string, and not the Expression issue you're ...
    (microsoft.public.sqlserver.dts)