35
Load table from SQLServer: ASPX data sets, C#
l<%@ Page language="C#" debug="true"%><%
lint i; long j=0,k=0; string cNotes; object oField; string cFields;
llong nStart=System.DateTime.Now.Ticks;
lcFields="_ID,Appointment_Notes FROM Visit_"; cFields="* FROM Visit_";
lSystem.Data.DataRowCollection oRows=
l  GetData("SERVER=(local);DATABASE=test;UID=user;Password=pass;",
l  "SELECT "+cFields+" WHERE Appointment_Notes IS NOT NULL");
lResponse.Write("Done "+((System.DateTime.Now.Ticks-nStart)/10000000.0).ToString()+
l  " "+oRows.Count.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</script>
l
lOn 850 MHz PIII: First cFields list gives (SQLClient) .18s [compare ASP at .25s]
lSecond cFields list (SQLClient) .98s [compare asp at .70s]