38
Use data from SQLServer: ASPX data sets
l<%@ Page language="C#" debug="true" aspcompat="true" %><%
lint i; long j=0,k=0; string cNotes; object oField; long nStart=System.DateTime.Now.Ticks;
lSystem.Data.DataRowCollection oRows=GetData(
l  "SERVER=(local);DATABASE=test;UID=user;Password=pass;",
l  "SELECT _ID,Appointment_Notes FROM Visit_");
lforeach (System.Data.DataRow oRow in oRows) {
l  j=j+(int)oRow["_ID"];
l  if (!oRow.IsNull("Appointment_Notes")) {cNotes=(string)oRow["Appointment_Notes"];k=k+cNotes.Length;}
l}
lResponse.Write("Done "+((System.DateTime.Now.Ticks-nStart)/10000000.0).ToString()+
l  " "+j.ToString()+" "+k.ToString()+"<br>");
l%>
l<script runat="server">
lSystem.Data.DataRowCollection GetData(string lcConnection,string lcQuery) {
l  System.Data.DataSet oDS=new System.Data.DataSet();
l  System.Data.SqlClient.SqlConnection oSqlClient=
l    new System.Data.SqlClient.SqlConnection(lcConnection);
l  System.Data.SqlClient.SqlDataAdapter oSqlDA=
l    new System.Data.SqlClient.SqlDataAdapter(lcQuery,oSqlClient);
l  oDS.Clear();
l  oSqlDA.Fill(oDS,"History");
l  return oDS.Tables["History"].Rows;
l}
l</script>
l
lOn 850 MHz PIII: 0.5 seconds