| |
agrizzle
Posts: 1
Score: 0
Joined: 9/3/2005
Status: offline
|
Hi. I am a rookie at using VBScript. I wrote 4 different VBScript files to query a remote data base and write the results in an Access 2000 database. The reason why I had to use 4 different files is the way the system is configured. That is out of my control. I inherited it that way. Anyway, I can query the entire database, but I want to run only one program. I was thinking of using ASP. I don't know how to run 4 VBScript files with the result going to Access using ASP. Can you help? If ASP is not the best solution, I am open to suggestions. This is an example of the VBScript that I am using. Thank you for any suggestions. ' VBScript source code 'This is the creation of the function GetPage. This is the function that retrieves the object from the URI Function GetPage(ByVal URL) Dim HttpRequest Set HttpRequest = CreateObject("Microsoft.XMLHTTP") HttpRequest.Open "GET", URL, False HttpRequest.Send GetPage = HttpRequest.responseText End Function 'This is the declaration of variables Dim counter, myNum Dim strHtml(200) 'Declaring object that retrieves overtime value' Dim CurrentURI(200) Dim oConnection(200),oConnection1(200) Dim oCommand(200),oCommand1(200) Dim strConnectionString Dim strSQL(200),strSQL1(200) Dim total ' start is second to last node found the total is the total number of nodes available. start=0 total=47 'This message box is to let you know that it started msgbox("Retrieving the Data") 'set a connection string to a database. You could probably get away without using an array of strings, 'but the program started to break down after 65 values were processed. This has to do with the way the 'system is set up. It will not allow more than 65 queries at one time. strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Desktop\test1.mdb;Persist Security Info=False" 'This is defining the array with the proper URI 'First Nodes '-------------------------------------------------------------------------------------------------------------------------------------- CurrentURI(1)="http://username:password@URI_1" CurrentURI(2)="http://username:password@URI_2" '-------------------------------------------------------------------------------------------------------------------------------------- 'This is the counter used to find the values at each URI counter=start Do counter=counter+1 strHtml(counter) = GetPage(CurrentURI(counter)) 'This points to what table and what field to insert the data strSQL(counter) = "insert into First(Reading,countn) values (" & strHtml(counter) & " , "& counter &")" Loop While counter < total 'This is where it makes the connection to the database. counter=start Do counter=counter+1 Set oConnection(counter) = CreateObject("ADODB.Connection") oConnection(counter).Open strConnectionString Set oCommand(counter) = CreateObject("ADODB.Command") oCommand(counter).ActiveConnection = oConnection(counter) oCommand(counter).CommandText = strSQL(counter) oCommand(counter).Execute Loop While counter < total msgbox( "Mission Complete")
|
|