123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Database Display via GetString

--------------------------------------------------------------------------------

Description : This page demonstrates the capabilities how to display a table from a SQL statement a very fast and scaleable way using a recordset method called GetString. GetString essentially asks the backend database to build a huge string instead of moving the data as rows and columns. It allows very limited specifications, basically what string to place between each column and row and how to display nulls. Notice the total absence of the traditional EOF loop. Its speed and scalability advantages are explained in: Http://www.learnasp.com/advice/whygetrows.asp This example does require ADO 2.0 or greater which can be downloaded from: http://www.microsoft.com/data If you are unsure which ADO version your server has http://www.learnasp.com/learn/versioncheck.asp will help you determine this. Does this approach matter for small data sets for example 9 rows x 2 columns of data? YES!!!!!!!! My site has SQLserver scripts that run like lightning. I once needed to fill a 9 item listbox from Access and got 90 sec script timeouts with movenext. Getstring never timed out. So in a real production situation it makes weak databases feasible and of course reduces the load on more industrial back-ends so maybe the SQLserver doesn't need as many indexes or RAM upgrades.

<TITLE>dbtablegetstring.asp</TITLE>
<body bgcolor="#FFFFFF">
<%
whichDSN="DSN=Student;uid=student;pwd=magic"
mySQL="select * from publishers where state='NY'"

Set conntemp=Server.CreateObject("adodb.connection")
conntemp.open whichDSN
Set rstemp=conntemp.execute(mySQL)
If rstemp.eof Then
Response.Write "No records matched<BR>
Response.Write mySQL & "
So cannot make table..."
Call CloseAll
Response.End
End If

Response.Write "<table border='1'><tr>"
'Put Headings On The Table of Field Names
For Each whatever In rstemp.fields
Response.Write "<td><b>" & whatever.name & "</B></TD>"
Next
Response.Write "</tr><tr><td>"
Response.Write rstemp.getstring(,, "</td><td>", "</td></tr><TR><TD>", "-null-")
Response.Write "</td></tr></table>"
Call CloseAll


Sub CloseALL
rstemp.close
Set rstemp=Nothing
conntemp.close
Set conntemp=Nothing
End Sub
%>
</body></html>

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG