How to connect to a MS SQL database using ASP.Net 1.1?

1. In web.config:
<add key="connStr" value="server=server_name_or_ipaddress; Initial Catalog=database_name; User Id=username; Password=password;" />

2. In your .aspx file:
<asp:Repeater ID="rep1" runat="server">
<HeaderTemplate><table border="1"></HeaderTemplate>
<td><%# DataBinder.Eval(Container.DataItem, "col1") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "col2") %></td>

3. In your .aspx.cs file:
using System.Data;
using System.Data.SqlClient;
protected Repeater rep1;
private void Page_Load(object sender, System.EventArgs e)
SqlConnection cn = new SqlConnection( System.Configuration.ConfigurationSettings.AppSettings["connStr"] );
SqlDataAdapter dap = new SqlDataAdapter("Select col1,col2 from sometable",cn);
Dataset ds = new DataSet();
rep1.DataSource = ds.Tables["somename"];

Bad Behavior has blocked 258 access attempts in the last 7 days.