<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Option Explicit
‘ Here is our multiplicity of connection strings. Note that they all
‘ share the same user name, but none have their parameters in the same
‘ order.
Const strConnectString1 = “Provider=sqloledb;User ID=pubsLogin; pwd=pubsPassword; Data Source= YourServerName; Initial Catalog=pubs”
Const strConnectString2= “Provider=sqloledb;Initial Catalog=pubs;User ID=pubsLogin; pwd=pubsPassword;Data Source= YourServerName;”
Const strConnectString3= “Provider=sqloledb;User ID=pubsLogin; pwd=pubsPassword; Initial Catalog=pubs; Data Source= YourServerName;”
Const strConnectString4= “Initial Catalog=pubs;Provider=sqloledb;User ID=pubsLogin; pwd=pubsPassword;Data Source= YourServerName;”
Const strSQL1 = “SELECT * FROM Authors WHERE au_lname=’This is SQL Statement 1′”
Const strSQL2 = “SELECT * FROM Authors WHERE au_lname=’This is SQL Statement 2′”
Const strSQL3 = “SELECT * FROM Authors WHERE au_lname=’This is SQL Statement 3′”
Const strSQL4 = “SELECT * FROM Authors WHERE au_lname=’This is SQL Statement 4′”
Dim cnPubs ‘ As New ADODB.Connection
Dim i
For i = 0 To 999
Set cnPubs = Server.CreateObject(“ADODB.Connection”)
‘ Note: we take the MOD of the current iteration (i) and
‘ use a different connection string and SQL statement every time
Select Case i Mod 4
Case 0
Response.Write “Connection #1, Iteration ” & i & “<br>”
cnPubs.ConnectionString = strConnectString1
cnPubs.Open
cnPubs.Execute strSQL1
Case 1
Response.Write “Connection #2, Iteration ” & i & “<br>”
cnPubs.ConnectionString = strConnectString2
cnPubs.Open
cnPubs.Execute strSQL2
Case 2
Response.Write “Connection #3, Iteration ” & i & “<br>”
cnPubs.ConnectionString = strConnectString3
cnPubs.Open
cnPubs.Execute strSQL3
Case 3
Response.Write “Connection #4, Iteration ” & i & “<br>”
cnPubs.ConnectionString = strConnectString4
cnPubs.Open
cnPubs.Execute strSQL4
End Select
Response.Write “ ” ‘ our simple delay tactic
cnPubs.Close
Set cnPubs = Nothing
Response.Flush
Next ‘ i
Response.Write “<p>Done”
</script>