Register
|
Articles
|
Questions
|
Projects
|
Asp.Net Tips
|
Free Magazines
|
Tutorials
|
Search
|
Write to us
|
Login
Search
Articles
Asp.Net 2.0
AJAX
ADO.Net
C#
Javascript
Books
Asp.Net 2.0
AJAX
ADO.NET
C#
JavaScript
MS SQL Server
VB.NET
XML
Web Service
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
Best Syntax to Open a SqlConnection in Asp.Net 2.0
Posted by
Moderator1
on
1/4/2008 2:48:15 AM
8071
Views
Here is the best method to open a SqlConnection in Asp.Net 2.0
using (SqlConnection conn = new SqlConnection("YourConnectionString"))
{
using (SqlCommand cmd = new SqlCommand("YourCommandString", conn))
{
conn.Open();
cmd.ExecuteNonQuery();
}
}
The above syntax opens and closes the connection along with the SqlCommand itself. Every effective in case of any error occurs in database manipulations.
Post New Tips/Tricks
View all Tips/Tricks
Featured Resources:
Easing the Migration to Microsoft SQL Server 2005
There are many business and technological reasons for making the move to SQL Server 2005 and SQL Server 2005 Enterprise Edition. In tandem with 64-bit computing platforms, SQL Server 2005 can boost performance by 30% in certain instances, deliver a better database management structure and bolster infrastructure security.
SearchSAP
The Web's best SAP-specific information resource for enterprise IT professionals.
100% Free Subscription until Stock lost.
View complete list.
Sponsored by
Home
About us
Contact Us
Links
Advertise
Privacy Policy
Copyright ©
2010
. www.AspdotnetCodes.com. All rights reserved.