OLEDB Connection problem using Connect String from Web.config

Hi,

Cananybody tell me why I am getting the following error for the following code below

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

"Ppp" is a connection defined in Web.config which works with SqlDatasource in the application.

DataSet RunQuery(String QueryString)

{

String ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Ppp"].ConnectionString;

OleDbConnection DBConnection = new OleDbConnection( ConnectionString);

OleDbDataAdapter DBAdapter;

DataSet ResultsDataSet = new DataSet();

M.Visible = false;

try

{

DBAdapter = new OleDbDataAdapter(QueryString, DBConnection);

DBAdapter.Fill(ResultsDataSet);

DBConnection.Close();

}

catch(Exception ex)

{

if(DBConnection.State == ConnectionState.Open)

{

DBConnection.Close();

}

M.Visible = true;

M.Text = "Unable to connect to the database.<BR>" + QueryString;

M.ForeColor = System.Drawing.Color.Black;

}

return ResultsDataSet;

}

0
mhariri
9/8/2005 5:00:29 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

0 Replies
979 Views

Similar Articles

[PageSpeed] 53

Reply:

Similar Artilces:

Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application
 Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application  please help me? Friend, Web.config has its own advantages. 1) Web.Config is used to store the important information like connections strings etc...so that it can be modified even after the code has been    deployed to the server without compiling the entire application again. 2) Since it is a XML file, there is no need of building the project of you are going to change the connection strings.   If you go for the class files,...

web.config connection string encryption using DPAPI
Hello, I have encrypted the connectionStrings section of my web.config using DPAPI. I use the below command. The problem is that once the connectionStrings section has been encrypted I get some errors in the web.config - "The 'configProtectionProvider' attribute is not declared" AND "The element 'connectionStrings' has an invalid child element 'EncryptedData'"  I have searched these forums and googled the problem. The only explanation I can find is to say this encryption method will not work with ...

web.config/ADO.NET command/connection string problem?
Ok, I have searched everywhere and not been able to find an answer yet so I hope someone can help me. I have an application that uses a key in the web.config file to reference a connection string to SQL Server 2000. In the development environment, this works as expected. However, when I edit the web.config file to reference a new database (initial catalog) it doesn't seem to register for some of the command objects (based on stored procs). I will receive an error that the user could not log on to database X, even though the connection should now be referencing database Y. This only happens w...

How do I use my web.config connection string in my DataAdapter/Connection that I created with drag/drop and data binding
This is a little hard to put into words... I have a form with a number of textbox fields on it that are bound to a data adapter. The data adapter and it's sql connection were created by dragging the objects onto the screen from the toolbox (not in code). I open connections in other places and use my connection string in web.config for those. The on-screen sql connection object doesn't seem to allow me to just fill in the function that pulls my conn string from web.config so in page.load, I set it's connection string to my connection string. Does the page load fire before the connect...

app.config connection string not being read
I have a Web app that has a UI Website Project and a DB dataset/db project. I am running SQL Server 2005 Express on my localhost for development purposes. I have the connectionstring for the DB in the DB projects app.config. The site is running perfectly on my localhost, but when I deploy the site to the review server and change the app.config's connectionstring accordingly a connection to the DB cannot be established. I then tried changing all the db names, usernames, password to jibberish in my app.config file on my localhost and running AND THE SITE STILL RAN ON LOCALHOST. For so...

Get connection string from web.config and secure that connection
Hi, I store my connection string on my web.config file, and I want to create a new connection on c# like:SqlConnection con = new SqlConnection();con.ConnectionString= //connection string on web.config fileAfter that, The connection string on the web.config file is in clear text and I want to make it secure but easy to work because this job is to deliver until friday. Is there any easy way to do this and keep the possibility of creating a new connection and making reference to this connection string without need for decrypt data?Thanks, please help!Best regards,David Ribeiro After reading t...

web.config having multilple connection string name with same connection.
Issue 1:   <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/>  And use Conn1(Read and Write from DB)  All over the application. (for exam: all Data Access Layer). VersusIssue 2: <add name="Conn1" connectionString="Data Source= SID;User Id=UN;Password=Pwd" providerName="Oracle.DataAccess.Client"/> <add name="Conn2" connectionString="Data Source= SID ;User Id=UN;Password=Pwd" providerName="Or...

the problem for connection string in web.config
I used one line in web.config <add key="ConnectionString" value="User ID=user;Password=user;Initial Catalog=Dashboard;Data Source=database_prod"/>to connect the production database. it works fine.I created a instance of the production database. then I used same line. just changed  the name. .<add key="ConnectionString" value="User ID=user;Password=user;Initial Catalog=Dashboard;Data Source=database_Dev"/>to connect the development database I was not able to log into. login fails. I don't know if code problem or set up database problem   Try including the ad...

How to use Connection String from Web Config
Hi All, How do I use the Web Config connection string in code behind? What is the syntax Dim oCnn As New SqlConnection= ???? Thanks    Dim oCnn As New SqlConnectionoCnn.ConnectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionStringDont forget to import System.Configuration Regards Mike [MVP - ASP/ASP.NET]My site...

web.config/connection string problem
Ok, I have searched everywhere and not been able to find an answer yet so I hope someone can help me. I have an application that uses a key in the web.config file to reference a connection string to SQL Server 2000. In the development environment, this works as expected. However, when I edit the web.config file to reference a new database (initial catalog) it doesn't seem to register. I will receive an error that the user could not log on to database X, even though the connection should now be referencing database Y. This only happens when attempting to execute an ADO.NET command. I have loo...

HOW TO USE THE CONNECTION STRING IN WEB.CONFIG
I have a connection string defined in the web.config file and as you know it is given a name.How can I reference such a connection string from a web form using the name given in the web.config file?What I actually do is to copy and paste the whole string in my web forms as follows:Dim pgConn As New PgSqlConnection("User Id=postgres;Password=p@ssw0rd;Host=localhost;Database=e-restdelivery;Persist Security Info=True;Schema=restaurant;Protocol=2")This method is not efficient because if the string changes I have to modify every web form where a connection string is locat...

Using a connection string from web.config
Ok. I thought this was going to be easy but it is turring out to be harder than I expected. I want to use a database connection string from the web.config file. If I use a sqldataadapter and configure a connection then the page works fine. If i attempt to use the information from the web.config file I get the following message when attempting to connect to the DB. The ConnectionString property has not been initialized. Here is the code that I am using to establish the connection. Imports System.Web.Security Imports System.Data.SqlClient Public Class WebForm1 ...

Placing an OleDb connection string in web config
I am developing a site and i want to keep my connection string in the web config in other to secure it and so that i  can easy upload the  site on a webserver without changing the path. but i am having a problem with it. I am a using a Microsoft Access database(OleDb). So i want an example of how to place the connection string in the web config and how i can retrieve it in my webpage. Thanks and God bless. This mght work. AccessDataSource control in page: <wmx:AccessDataSourceControl id="AccessDataSourceControl1"    runat="server"    SelectComma...

How to use the connection string from the web.config with a method?
I have been trying to create the connection and then pass it around with no luck. Instead I've been able to just keep recreating it with each method on the page. I don't know why when I create a variable in the page_load event it just doesn't get seen inside of methods. If I put the variable holding the connection string in the page before the page_load event, I think the page class?, it still doesn't work. Could someone give me a heads up on why please? THank you so much in advance.  1 using System;2 using System.Data;3 using System.Configuration;4 usin...

Web resources about - OLEDB Connection problem using Connect String from Web.config - asp.net.presentation-controls

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Ben Garcia gives Penrith Panthers a new French connection
Should he jag a game in the NRL, Ben Garcia will become just the third genuine French import to do so.

Man Charged With Aggravated Arson In Connection To Columbus Warehouse Fire
Police have charged 30-year-old Robin Toms with aggravated arson.

This Is How Facebook Is Working to Improve Experience On Slower Connections
... the globe, that’s not their situation . In recent years, Facebook has paid close attention to its user experience on 2G and other slow connections. ...

Addappt now lets you block contacts and connections
... gives you even more control than before. New features Block a current contact from connecting if they use Addappt down the road Block a connection ...

Facebook becomes more adept at dealing with crappy connections
... to get a decent phone signal to allow you to post a photo of your meal. Joking aside, in countries where people are struggling with 2G connections ...

Internet connections at UK universities have been knocked out by a 'persistent' cyber attack
... internet following a targeted cyber attack on a nationwide education network. The University of Manchester said on Tuesday its internet connection ...

Resources last updated: 12/17/2015 3:49:27 AM