J
jnikle
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
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