ElJayWilson
Programmer
For the life of me, I cannot figure out why I am getting this error:
Microsoft VBScript Compilation error 800a0401
Expected end of statement
/ajax/ajax.asp line 13
dim myCommand as string = Request.QueryString("cmd"
-----^
Here is my code
I am simply trying to pass a QueryString value to a stored proc and get back information. I have tried not assigning a value at declaration time and I still get the error.
I am lost (and new to ASP)
Microsoft VBScript Compilation error 800a0401
Expected end of statement
/ajax/ajax.asp line 13
dim myCommand as string = Request.QueryString("cmd"
-----^
Here is my code
Code:
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
' Create connection and command objects
Set cn = New ADODB.Connection
Set cmd = New ADODB.Command
Set rs = New ADODB.Recordset
dim myCommand as string = Request.QueryString("cmd")
select case myCommand
case "getpatacct"
dim strConn As String
dim strSpName as String = "pEreq_Get_PatAcctData"
dim patAcctNBR as string = Request.QueryString("acctnbr")
strConn = "Provider=SQLOLEDB.1;Password=PASSWORD;Persist Security Info=True;User ID=USER;Initial Catalog=SERVER;Data Source=DB"
cn.ConnectionString = strConn
cn.CursorLocation = adUseClient
cn.Open
'set the locktype and cursor to cheapest
rs.LockType = adLockReadOnly
rs.CursorType = adOpenForwardOnly
' Set command properties
With cmd
Set .ActiveConnection = cn
.CommandText = strSpName
.CommandType = adCmdStoredProc
Set params = .Parameters
End With
' append the one parameter
params.Append cmd.CreateParameter("PATACCTNBR", adEmpty, adParamInput, adEmpty, patAcctNBR)
' Execute the command
Set rs = cmd.Execute
If Not rs.EOF Then
Response.Write rs(1) & "<br />" & _
rs(2) & "<br />" & _
rs(3) & "<br />" & _
rs(4) & "<br />"
End If
rs.ActiveConnection = Nothing
Set rs = Nothing
Set cmd.ActiveConnection = Nothing
end select
cn.Close
Set cmd = Nothing
Set cn = Nothing
I am simply trying to pass a QueryString value to a stored proc and get back information. I have tried not assigning a value at declaration time and I still get the error.
I am lost (and new to ASP)