Results 1 to 2 of 2

Thread: Linking a Script File in VB Script

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    13

    Linking a Script File in VB Script

    I was wondering if it is possible to link a script file in VB script similar to the way you do in JavaScript.

    I have five or six different pages that gather information from a SQL Server database depending on certain user inputs and displays the records the same way everytime. The Code that draws the table and places the individual records is pretty long and I would like to have it all in one place.

    I cut the code out of one of my pages and saved it in a .vbs file and then entered this in place of it.

    <SCRIPT SRC="list.vbs" LANGUAGE="VBScript">
    <--
    //-->
    </SCRIPT>

    When I try to have my page return records I get a runtime error.

    Line: 1
    Error: Object required: 'rData'

    My page works fine without the attempted link to the .vbs file.

    This my code to connect to the database and create a recordset.

    Set cConn = Server.CreateObject ("ADODB.Connection")
    cConn.Open "Provider=SQLOLEDB;User ID=UserID;Password=pass;Persist Security Info=False;Initial Catalog=dbase;Data Source=server"
    Set rData = cConn.Execute(Select Statement)

    Instead of using the Execute statement I tried Set rData = Server.CreateObject ("ADODB.Recordset") but this didn't work; I got the same error.

    I assume that I have to somehow pass the rData recordset to the .vbs page but this is where I am stuck.

    Any help would be appreciated.

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Are you trying to do it server-side? Use includes:
    <!--#include file="includedfile.asp"-->
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width