Ideally, when setting up a data-driven PHP site, you should have your configuration and database connection code separate from your code that generates content. What I want to display is a simple way to keep things separate and simple to work with. I use a config/index/data file structure. There are...
database connection
Create connection string:SqlConnection conn = new SqlConnection(“Data Source=DATASOURCE\\\\SQLEXPRESS;Initial Catalog=DATABASE_NAME;Integrated Security=True”); try { conn.Open(); SqlCommand sql = new SqlCommand(“SELECT * FROM tableName”, conn); SqlDataReader reader = sql.ExecuteReader(); while (reader.Read()) { this.TARGET_ID.InnerHtml += reader[“column”] ; } } catch (SqlException sqle) { sqle.Message.ToString(); }