All source code in .Net Ask a .Net Pro Discussion Forum Categories All jobs in .Net
ADOnet,Programming,article,which,focus,both,w
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
.Net Stats

 Code: 655,633. lines
 Jobs: 804. postings

 How to support the site

 
Sponsored by:
Quick Search for:  in language:    
You are in:
 
Login





Latest postings for .Net.
VB .Net ODBC and Vista 64 bit
By Malakie-USN on 11/20


Click here to see a screenshot of this code!Sockets - Client / Server / Silverlight
By Ignyte Software, Inc. on 11/19

(Screen Shot)

WYSIWYG HTML-Editor control (WinForms)
By Matthias Broschk on 11/19


Click here to see a screenshot of this code!Read/Write exe.config
By junindar on 11/18

(Screen Shot)

Click here to see a screenshot of this code!Unix Time Stamp
By CBH on 11/18

(Screen Shot)

Click here to see a screenshot of this code!GLOSSARY ICONBETA SITE Beta RODLEWIS 2009 copyright trial
By ROD LEWIS on 11/18

(Screen Shot)

Click here to see a screenshot of this code!TeamVision Revisted 3.0
By ArkitechEBC on 11/16

(Screen Shot)

Click here to see a screenshot of this code!Simplest Explorer Treeview
By M1K3 on 11/16

(Screen Shot)

Click here to see a screenshot of this code!Lite Brite Application
By Brian McCumber on 11/11

(Screen Shot)

Click here to see a screenshot of this code!CAR DEALER/ CAR SALE
By YESSOUFOU ABDEL RAOUF on 11/10

(Screen Shot)

Click here to see a screenshot of this code!CPU usage tester / benchmark
By Timo Boehme on 11/16

(Screen Shot)

Arrays functions
By Jerome Scott II on 11/15


C# regex example
By Jerome Scott II on 11/15


C# list processes
By Jerome Scott II on 11/15


Click here to see a screenshot of this code!Speak and Spell
By Brian McCumber on 10/31

(Screen Shot)

Click here to see a screenshot of this code!Scratch Pad
By Brian McCumber on 11/15

(Screen Shot)

Click here to see a screenshot of this code!Alarm Clock v8
By Brian McCumber on 10/25

(Screen Shot)

ReadFile
By Does It Even Matter? on 11/14


Insert SQL Writer
By dojsys HEK on 11/13


Function to write SQL Statement
By dojsys HEK on 11/13


Click here to see a screenshot of this code!Save, Retrieve Image from Database (MSSQL)
By brandon teoh on 11/12

(Screen Shot)

Click here to see a screenshot of this code!Pic View Application
By Brian McCumber on 11/11

(Screen Shot)

Secure LAN Communicator
By ASAD SAEED CHOHAN on 11/12


Click here to see a screenshot of this code!Send Mail For CMD With System.Net.Mail
By Jimmy_to on 11/9

(Screen Shot)

sildbconn
By elumalai on 11/12


Tip
By Kaland on 11/11


Click here to see a screenshot of this code!Mail_Text Message
By Mike_ Murphy on 11/11

(Screen Shot)

Click here to see a screenshot of this code!Reaction!
By Brian McCumber on 10/25

(Screen Shot)

Alarm Clock
By bruno_RAM on 11/11


Click here to see a screenshot of this code!Instructions and procedures word or adobe to any Descktop picture icons
By ROD LEWIS on 11/10

(Screen Shot)

Dif Years Between Brothers
By Fvg@ on 11/10


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

ADO.net Programming Style

Print
Email
 
winzip icon
Submitted on: 7/22/2006 7:26:15 PM
By: DailyFreeCode.com  
Level: Intermediate
User Rating: By 10 Users
Compatibility:C#

Users have accessed this code 14539 times.
 
author picture
(About the author)
 
     ADO.net Programming article which focus on both how to write efficient code and how to represent the information which take advantage of layered design of .net framework. Articles describes how you can write code efficiently and improve performance of application and avoids errors due to poor coding style. Advantages of Article and DemoCode are : i) Opening of connection for a short time and Closing it as soon as database task is completed, it thus help in improving performance of application. ii) Better usage of Error-Handling, to make sure that connection is closed even if the exception occurs. iii) Follow Stateless design, taking all needed information as parameter and return all the data through return value. It helps in load balancing and it would be easy while implementing web-service. iv) Storing connection string in app.config file allow us to made a single change, to change a connection string. It helps in connection pooling.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/12/2006 9:34:35 PMAdnan

What a great article, very nice job! I was wondering if you could provide a VB version also. I am sure lots of people would love it.

Again, great job!!!
(If this comment was disrespectful, please report it.)

 
7/17/2006 10:43:35 PMIVan

Great Code and Article Guru, * * * * *
(If this comment was disrespectful, please report it.)

 
7/25/2006 7:33:15 PMVJFree

Good article, thanks 5 globe for that.
(If this comment was disrespectful, please report it.)

 
7/25/2006 11:51:13 PMGauri

I come across this article link through yahoogroup, well this article make me learn a new way of ado.net programming thanks.
(If this comment was disrespectful, please report it.)

 
7/25/2006 11:55:20 PMGauri

if possible can u explain, databinding technique which has been used in this programming article. Enjoy 5 Globe from me. I also like to be in your programming group list. Thanks again
(If this comment was disrespectful, please report it.)

 
7/26/2006 2:01:21 AMworksoft

Suggestion

you can even execute stored proc by this way which is much more easy to understand

public EmpDetails[] GetAllEmp()
{
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("tGetAllEmp",conn);
cmd.CommandType = CommandType.StoredProcedure;
ArrayList arrEmp = new ArrayList();

try
{
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while(dr.Read())
{
EmpDetails emp = new EmpDetails((int)dr["EmployeeId"],(string)dr["FirstName"],(string)dr["LastName"]);
arrEmp.Add (emp);
}
dr.Close();
return (EmpDetails[])arrEmp.ToArray(typeof(EmpDetails));
}
catch(SqlException err)
{
throw new ApplicationException("Data Error");
}
finally
{
conn.Close();
}
}


(If this comment was disrespectful, please report it.)

 
8/11/2006 6:03:29 AMnguyen quang

very usefully.
very simple.
very clearly.
(If this comment was disrespectful, please report it.)

 
1/7/2007 12:05:25 PMdungtd

Hi, thanks a lot.Try to continue.
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Games | Feedback | Customize | .Net Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2009 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.