Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

CornerBLUE, Inc. http://www.cornerblue.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

C#: Execute A Query & Return A Reader

   1  
   2  public static SqlDataReader GetReader(string Query)
   3  {
   4  	string ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["CONNECTION_STRING_NAME"].ConnectionString;
   5  	SqlConnection con = new SqlConnection(ConnectionString);
   6  	SqlCommand command = new SqlCommand();
   7  
   8  	command.Connection = con;
   9  	command.Connection.Open();
  10  	command.CommandText = Query;
  11  	return command.ExecuteReader();
  12  }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS