LISTING 2: VBScript Function to Get Resultset Using Stored Procedures <% '---- User name and password for SQL Server & ADO connection. Const dbConnectString = "Driver={SQL Server};Server=(local);Database=TREETEST" Const dbUserID="sa" Const dbPwd="" %> This block declares the three constants required for an ADO connection. Change the database name to whatever you have created and similarly the username and password should be valid for a logon or else the page would fail. <% ' '-- To get the activity schedule tree in resultset tree form. ' Function GetActivityTreeFromDB Dim oConn, oCmd '--- Create ADO connection object. Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open dbConnectString, dbUserId, dbPwd oConn.CursorLocation = adUseClient '--- Create ADO command object for executing stored procedures. Set oCmd = Server.CreateObject("ADODB.Command") oCmd.ActiveConnection = oConn oCmd.CommandType = adCmdStoredProc oCmd.CommandText = "tsp_prj_activity_tree_list" '--- Execute the procedure via the Command object and '--- return the resultset. Set GetActivityTreeFromDB = oCmd.Execute() '--- Clean up. Set oCmd = Nothing: Set oConn = Nothing End Function %>