|
-
May 2nd, 2001, 09:49 AM
#1
Thread Starter
New Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|