Revision: 2385
Updated Code
at February 7, 2007 05:32 by gndprx
Updated Code
private void bindSomething() { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString_From_WebConfig"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString); string selectSQL = "Select * from tablename"; SqlCommand getStuff = new SqlCommand(selectSQL, conn); try { conn.Open(); SqlDataReader reader = getStuff.ExecuteReader(); while (reader.Read() == true) { someLabel.Text = Convert.ToString(reader["column1"]); someLabel2.Text = Convert.ToString(reader["column2"]); } reader.Close(); } catch { Response.Write("Error retrieving data"); } finally { conn.Close(); } }
Revision: 2384
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 7, 2007 05:31 by gndprx
Initial Code
private void bindArticle() { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString_From_WebConfig"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString); string selectSQL = "Select * from tablename"; SqlCommand getStuff = new SqlCommand(selectSQL, conn); try { conn.Open(); SqlDataReader reader = getStuff.ExecuteReader(); while (reader.Read() == true) { someLabel.Text = Convert.ToString(reader["column1"]); someLabel2.Text = Convert.ToString(reader["column2"]); } reader.Close(); } catch { Response.Write("Error retrieving data"); } finally { conn.Close(); } }
Initial URL
Initial Description
Initial Title
Simple SqlDataReader C# / .Net 2.0
Initial Tags
Initial Language
C#