L
Larry_Milner
I'm, trying to generate a random number to be used in a DB lookup of wav
files that can be used as BG sound bytes.
I'm missing something along the STRSQL = line that's blocking me.
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "SELECT WavName FROM "]'
/random_number.asp, line 21
The number generates correctly and the field being selected is the primary
index and an integer (autonumber).
I generate an SQL pull that will work correctly with DATABASE results
wizzard, but not with a random number.
Can anyone see a problem in my syntax?
___________________
<%
Dim intLB
Dim intUB
Dim intRange
Dim sngRanVal
Dim intRanInt
Dim DSN_Name
DSN_Name = Application("Web_ConnectionString")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name
Set RS = Server.CreateObject("ADODB.Recordset")
intLB = 1
intUB = 30
Randomize()
intRange = intUB - intLB + 1
sngRanVal = intRange * Rnd()
sngRanVal = sngRanVal + intLB
intRanInt = Int(sngRanVal)
strSql = "SELECT WavName FROM WavTable WHERE ( ID = ::'" + intRanInt + "
:"'"
RS.Open strSql, Connection
Dim SNDFile
SNDFile = rs("wavename")
RS.close
Connection.close
%>
<html>
<head>
<title>Random BG Sound</title>
<bgsound src ="sounds/wavtable/<%=SNDFile%>">
</head>
</body>
</html>
_____________________________________
files that can be used as BG sound bytes.
I'm missing something along the STRSQL = line that's blocking me.
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "SELECT WavName FROM "]'
/random_number.asp, line 21
The number generates correctly and the field being selected is the primary
index and an integer (autonumber).
I generate an SQL pull that will work correctly with DATABASE results
wizzard, but not with a random number.
Can anyone see a problem in my syntax?
___________________
<%
Dim intLB
Dim intUB
Dim intRange
Dim sngRanVal
Dim intRanInt
Dim DSN_Name
DSN_Name = Application("Web_ConnectionString")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name
Set RS = Server.CreateObject("ADODB.Recordset")
intLB = 1
intUB = 30
Randomize()
intRange = intUB - intLB + 1
sngRanVal = intRange * Rnd()
sngRanVal = sngRanVal + intLB
intRanInt = Int(sngRanVal)
strSql = "SELECT WavName FROM WavTable WHERE ( ID = ::'" + intRanInt + "
:"'"
RS.Open strSql, Connection
Dim SNDFile
SNDFile = rs("wavename")
RS.close
Connection.close
%>
<html>
<head>
<title>Random BG Sound</title>
<bgsound src ="sounds/wavtable/<%=SNDFile%>">
</head>
</body>
</html>
_____________________________________