Displaying records of MSSQLWe can use one do-while loop to display all the records present in a database by using record set object of ASP. The looping and displaying part is same as displaying records of an access database.
We already have connection string in a file conn.asp at the root of the server and we include them by using include virtual command. So at the top of the file we will fist read the common connection file to get the connection string. Here we will also include adovbc.inc file
We will fist establish the connection and once the connection is open then we will declare a recordset object. The recordset object will use the query to collect the records. Then we will use one Do While loop to display one by one all the records. At the starting of each iteration of the while loop we will check the end of file condition EOF is true or not , if record exist then EOF will be false so we will take the NOT condition of this and execute the code inside the loop to display a record. At the end of each loop we will move recordset pointer by one step by using MoveNext command.
Here is the complete code to display the records.
This article is written by plus2net.com team.
Be the first to post comment on this article :