Skip to content

Instantly share code, notes, and snippets.

@markoo
Created April 23, 2014 12:56
Show Gist options
  • Save markoo/11214241 to your computer and use it in GitHub Desktop.
Save markoo/11214241 to your computer and use it in GitHub Desktop.
SQL Conn code
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