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.

10/25/2005 3:11:28 PM 2237 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 29

This mght work.

AccessDataSource control in page:

<wmx:AccessDataSourceControl id="AccessDataSourceControl1"
   SelectCommand="SELECT * FROM [Employees]" >

Code in the page:

Sub Page_Init()
    AccessDataSourceControl1.ConnectionString = ConfigurationSettings.AppSettings("accessNorthwind")
End Sub

Web.config file:

    <add key="accessNorthwind"
       value="Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=c:\test\northwind.mdb" />

Does this help?

-- Mike Pope

ASP.NET User Education

This posting is provided "AS IS" with no warranties, and confers no rights.

11/4/2005 5:56:31 AM

Similar Artilces:

Can't read (connection) string from web.config with web matrix
Hi, I'm trying to retrieve a connection string from a web.config file and I get nothing back when I use ConfigurationSettings.AppSettings["ConnectionString"]; I set up a test stub called configtest.aspx to try to see what was wrong but I can't see where the problem is. I would really appreciate an extra pair of eyes here to help me solve this mystery cheers Jeet Here is my code <%@ Page Language="C#" %> <%@ import Namespace="System.Configuration" %> <script runat="server"> void Page_Load(Ob...

Updating Web.Config( ^SqlConnectionString^ was not found in web.config. Connection String was not updated).
hi ppl i installed the forum and when it was fininshed im not getting the fierst screen. when i wrote it myself on the explorer http://localhost/Forums it gave an error like this:::::::::::::::    Login failed for user 'amit'. Reason: Not associated with a trusted SQL Server connection Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'amit'. Reason:...

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....

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 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 web web
Name: bahadir Email: Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

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...

web.config, app.config Connection strings
Hi all,   My difficulty is the configuration of the following Connection String.    <connectionStrings>        <add name="RMS_DAL.My.MySettings.RMSConnectionString" connectionString="Data Source=DEV01;Initial Catalog=RMS;Integrated Security=True"            providerName="System.Data.SqlClient" />    </connectionStrings>    In visual Studio  I have a 3 tier "Solution" like this  &nb...

running 2 web.configs in the same website 1 in /web.config and one in /swf/web.config
Im having issues doing this. and when i remove the authentication from the swf/web.config it still doesnt seem to be applying to the child website at all. Whats the proper way to set a child website? Thanks!!  The lower most web.config overrides all previous settings. So if you remove the section from the /swf/web.config whatever settings you have in the web.config in the next higher level will have an effect on the content of the child folder.So instead of removing a section, try giving appropriate settings in the /swf/web.config....

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...

seriously confused about connections strings, app.config, web.config ...
I have a web application that comprises the following: A web project (with a web.config file containing a connection string - but no data access code in the web project) A data access project that uses LINQ-SQL classes to provide entities to the web project UI (this project has a settings file and an app.config - both of which have connection strings) When I build and deploy, there is no settings file or app.config in the Bin directory with the data access .dll, but changing the connection string in the web.config file doesn't change the database accordingly - so ...

Connect a DataSet to a database with a connection string defined outside of web.config
I believe this to be a fairly small issue in a fairly complex scenario; I'll do my best to explain. We have 2 solutions, and one is built using the other as a foundation.  In other words, one solution has all the functionality of the other, and then some other things added on.These 2 solutions need to connect to different databasesMany of the projects in the solutions, as well as the web.config file are "branched" between the two solutions.  Meaning that editing the web.config file in one solution will effect it in the other.To allow each solution to connect to a...

web.config--connection string
i have a connection string in the web.config in the connectionstring i have the database name which is hardcoded.But i want to pass the Database Name as a parameter.The other details of the connection string are same. how do i do this. and i don't know XML String dbname = ... ConnectionString = String.Format(ConfigurationSettings.AppSettings["ConnectionString"],dbname); You would store the connection string in web.config like this: "server=localhost;trusted connection=true;DataSource={0}"~Dave Foderick...

connection string in the Web.config
I read an article for putting the connection string in the Web.config. Any one have sample code. Thanks. I found the answer in after my posting.Thanks. Hi, take a look at this sample code. You need the source and the web.config. Be very carefull with what you put in the web.config because it's case sensitive. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Web resources about - Placing an OleDb connection string in web config -

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 -
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 ...

Half of data connections by top 500 Android apps are 'covert' with no effect on user experience
Researchers at the Massachusetts Institute of Technology have discovered that half of the communications connections established by the top free ...

The Direct Connection
... And the people reading my words respond back to me with words of their own. The technology that allows this is powerful but this direct connection ...

Is There A Connection Between Patrick Murphy's Over-The-Top Corruption And His Campaign Emails?
The DCCC may be stupid or even very stupid (as well as utterly incompetent) but their e-mail strategy is very well-planned out. Their overarching ...

Cross-cultural Connections and Exchange: international study is more important than ever
... And, as a minority of ill-intentioned individuals and groups do their best to create divides, we need citizens equipped to create connections ...

Connection And Collaboration In the Cloud
Forbes technology editor Bruce Upbin deconstructs the cloud and maps its potential to your life.

Mali arrests 2 in connection with deadly hotel attack
Mali arrests 2 in connection with deadly hotel attack

Resources last updated: 12/3/2015 4:03:17 AM