Tutorials
Resources
Forum
Communities
Interview
Jobs
Projects
Offshore Development
Silverlight Tutorials
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Revenue Sharing
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Abhi
(65)
Appukuttan
(40)
raj krishna
(37)
Last 7 Days
Appukuttan
(660)
Babu Akkandi
(465)
Tejinder Singh ...
(273)
more...
New Feature:
Community Sites
:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
How Design patterns make .net 2.0 a miracle
Posted Date: 11 Aug 2006
Resource Type:
Articles
Category:
Web Applications
Author:
Ved Prakash
Member Level:
Bronze
Rating:
Points
: 2
Design Patterns in .Net
Writing Generic data access code
Summary
Till .net 1.1 we were able to use single provider at a time means we were not able to change providers run time.Now with the help of provider pattern .net has given us the gift of system.data.common namespace .with the help of that we can create the connection object run time .we can use different providers for Oracle ,sql server ,MS Access or xml what ever we want . as follows
string factory = WebConfigurationManager.AppSettings["factory"];
DbProviderFactory provider = DbProviderFactories.GetFactory(factory);
DbConnection connection = provider.CreateConnection();
connection.ConnectionString=WebConfigurationManager.ConnectionStrings"ProductCatalog"].ConnectionString;
DbCommand command = provider.CreateCommand();
command.CommandText = WebConfigurationManager.AppSettings["ProductQuery"];
command.Connection = connection;
connection.Open();
DbDataReader reader = command.ExecuteReader();
In the above article I have used a word factory in Appsetting which is being given in web config file as a tag. for more detail wait for my next article
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Difference Between usercontrol and custom control in .net
Previous Resource:
Highlight Searchtext in Datagrid or in a Page
Return to Discussion Resource Index
Post New Resource
Category:
Web Applications
Post resources and
earn money
!
Related Resources
To display the custom error in web Application
Advertisements on a web form
ASP.NET 2.0 Deployment : Installer for updating Web.Config settings during Setup - Part II
Error: "Parser Error Message: Could not load type 'WebApplication1.Global'." when browsing an asp.ne
Getting the IE Webcontrols work in ASP.NET 2.0 while using Visual Studio 2005
dotNet Slackers
BizTalk Adaptors
Web Design
Contact Us
Privacy Policy
Terms Of Use