I am new to VBScript. I was trying write the following code but could not figure out error here. Please help. following is the code
I get
Expected end of statement line 19, column 8
Dim strConnect
Dim objCommand, objRS , intNoofRecords
Dim dtStartDt,dtEndDt,strCounty
Set objCommand = Server.CreateObject("ADODB.Command") ' create the Command object
' fill in the command properties
objCommand.ActiveConnection = strConnect
dtStartDt = Request.Form("eleStartDt")
dtEndDt = Request.Form("eleEndDt")
strCounty = Request.Form("elecounty")
Dim str = "SELECT * FROM Participant"
response.write(str)
objCommand.CommandText = "SELECT * FROM Participant"
' objCommand.CommandText = "SELECT * FROM Participant WHERE Analysis_Date BETWEEN " & dtStartDt & "AND" '& dtEndDt & " AND County = " & 'strCounty'
objCommand.CommandType = adCmdText
' now execute the command, and capture the selected records in a recordset
Set objRS = objCommand.Execute intNoofRecords
' The Command object has done its job, so clean it up
Set objCommand = Nothing
If intNoofRecords > 5 Then
' now loop through the records
While Not objRS.EOF
Response.Write objRS("Analysis_Date") & ": " & objRS("County") & "<BR>"
objRS.MoveNext
Wend
' now close and clean up
objRS.Close
Set objRS = Nothing
Else
msg = "There should be at least 5 participants to analyse the data"
Response.write ("<" & "script language=VBScript>")
Response.write ("Msgbox """ & msg & """<" & "/script>")
' now close and clean up
objRS.Close
Set objRS = Nothing
Response.Redirect "newApplication.asp"
End If
I get
Expected end of statement line 19, column 8
Dim strConnect
Dim objCommand, objRS , intNoofRecords
Dim dtStartDt,dtEndDt,strCounty
Set objCommand = Server.CreateObject("ADODB.Command") ' create the Command object
' fill in the command properties
objCommand.ActiveConnection = strConnect
dtStartDt = Request.Form("eleStartDt")
dtEndDt = Request.Form("eleEndDt")
strCounty = Request.Form("elecounty")
Dim str = "SELECT * FROM Participant"
response.write(str)
objCommand.CommandText = "SELECT * FROM Participant"
' objCommand.CommandText = "SELECT * FROM Participant WHERE Analysis_Date BETWEEN " & dtStartDt & "AND" '& dtEndDt & " AND County = " & 'strCounty'
objCommand.CommandType = adCmdText
' now execute the command, and capture the selected records in a recordset
Set objRS = objCommand.Execute intNoofRecords
' The Command object has done its job, so clean it up
Set objCommand = Nothing
If intNoofRecords > 5 Then
' now loop through the records
While Not objRS.EOF
Response.Write objRS("Analysis_Date") & ": " & objRS("County") & "<BR>"
objRS.MoveNext
Wend
' now close and clean up
objRS.Close
Set objRS = Nothing
Else
msg = "There should be at least 5 participants to analyse the data"
Response.write ("<" & "script language=VBScript>")
Response.write ("Msgbox """ & msg & """<" & "/script>")
' now close and clean up
objRS.Close
Set objRS = Nothing
Response.Redirect "newApplication.asp"
End If