Created
January 2, 2015 17:51
-
-
Save a7madev/b8d5e613f70ba68c35ae to your computer and use it in GitHub Desktop.
C# Retrieve Data from Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SqlConnection con = new SqlConnection(); | |
SqlCommand cmd = new SqlCommand(); | |
cmd.Connection=con; | |
cmd.CommandType=CommandType.Text; | |
cmd.CommandText="select column from table where condition;"; | |
con.ConnectionString= projectname.Properties.Settings.Default.DatabaseNameConnectionString; | |
SqlDataReader myReader; | |
con.Open(); | |
myReader= cmd.ExecuteReader(); | |
con.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment