Explore BrainMass

Explore BrainMass

    Creating scripts to Process differences between inline and script

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    1. Because of the processing differences between inline and script on the server-side, under what conditions would you use script?

    2. Create a script that uses the following components: an array, sub procedure, explicit declaration, RUNAT=Server, and a function.

    © BrainMass Inc. brainmass.com June 3, 2020, 7:17 pm ad1c9bdddf

    Solution Preview

    1. when modularity is desirable. Script is more modular. Also when the script is used more than once in the program, then use a script in stead of inline. This can avoid repeatitive code. Another occasion is when the inline is too long, then it is better to define it in a script and then use the script.

    2. Database Record Killer: which lets you delete a bunch of records in one call to the page.

    <%@ Page Language="VB" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <script language="VB" runat="server">

    Sub Page_Load(Sender As Object, E As EventArgs)
    Dim myConnection As SqlConnection
    Dim myCommand As SqlCommand
    Dim myDataReader As SqlDataReader

    Dim strRecordsToDelete As String
    Dim arrRecordsToDelete As Array
    Dim I As Integer

    ' Create connection object using our SQL Server connection string.
    myConnection = New SqlConnection("Data Source=;" _
    & "Initial Catalog=samples;User Id=samples;Password=password;" _
    & "Connect Timeout=15;Network Library=dbmssocn;")

    ' Open the connection to the database

    ' Create our command object
    myCommand = New SqlCommand()

    Solution Summary

    I offer help with creating scripts.