Real Time Data Grid Part 2/2 - Using our DynamicGrid class
(Page 5 of 6 )
Because everything we need to use our DynamicGrid class is encapsulated into one ASP file, all we have to do is make a slight modification to the file in order for it to work. Make sure the strConnectionString variable is set to connect to your SQL Server 2000 database correctly. If you want to test it with your own database, then change the value of the "Initial Catalog" part of the connection string to match the name of your database. Also make sure that the user ID and password fields are correct for your server.
Create a new ASP page called testgrid.asp and save it in the same directory as dynamic.datagrid.asp in a directory that IIS can access. Enter the following code into testgrid.asp:
<!-- #INCLUDE file="dynamic.datagrid.asp" -->
<%
Dim dg1
Set dg1 = new DynamicGrid
dg1.TableName = "authors"
dg1.InitializeGrid
dg1.DisplayGrid "100%", 1, "#E7E3E7", "#BDDBFF", false, false
%>That's all the code we need to use our DynamicGrid class in any ASP page. As you can see, I've made the CanEdit and CanDelete arguments false, so when the page is displayed we don't have the option to update or delete records:

Next: Conclusion >>
More ASP Articles
More By Annette Tennison