Created
April 23, 2014 12:56
-
-
Save markoo/11214241 to your computer and use it in GitHub Desktop.
SQL Conn code
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
public string Get(int id) | |
{ | |
try | |
{ | |
string result = ""; | |
using (sqlConn) | |
{ | |
using (SqlCommand cmd = new SqlCommand("Select * from FootballMatch", sqlConn)) | |
{ | |
sqlConn.Open(); | |
SqlDataReader reader = cmd.ExecuteReader(); | |
while (reader.Read()) | |
{ | |
result += String.Format("{0}", reader[0]); | |
} | |
} | |
} | |
return result; | |
} | |
catch (SqlException ex) | |
{ | |
} | |
finally | |
{ | |
conn.Close(); | |
} | |
return "value"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment