Re: SQL Server 2005 Express connection error?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Unfortunately, that didn't do the trick. Thanks for the suggestion
though. Any other thoughts?

-Josh


Berkshire Freddo wrote:
sperhap you did not use the key word imports (using in C#)
System.Data.SQLClient prior to the beginning of your class. This allows u to
have access to the members of that class. I hope u find this helpfull. In
vb.net we use the key word imports.

"jnikle@xxxxxxxxx" wrote:

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: Database interactions dont fire from Application_Start in Global.asax?
    ... tell that it's not updating my database. ... session ID in the database to prevent multiple logins. ... 'Creates the database's Connection object ... 'Tells the command object to use the connection above ...
    (microsoft.public.dotnet.framework.aspnet)
  • 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)