I have an Access query that won't work within case select in ASP code! I have saved this query in the Access database under qryUpdate. The error message is "Invalid SQL Statement; Expected 'DELETE','INSERT'..." I Dim and Set Connection and RecordSets outside the case select, then in the case select body, I try to execute the query through objRS.Open strQuery, objConn.
The funny thing is, in my first case, which uses a SELECT type query, the query works.
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString = "DSN=myDSN"
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset"
Dim strQuery
select case strChoice
case "choiceA"
'qrySelect in the db is: SELECT * from Employees
strQuery = "qrySelect"
objRS.Open strSQL, objConn
' stuff to deal with RecordSet
objRS.Close
case "choiceB"
'qryUpdate in the DB is UPDATE Employees SET status='Active' where available='Y'
strQuery = "qryUpdate"
objRS.Open strSQL, objConn
objRS.Close
end select
' clean up objRS and objConn
I can do this query outside the select case and it works fine. Any ideas???????
The funny thing is, in my first case, which uses a SELECT type query, the query works.
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString = "DSN=myDSN"
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset"
Dim strQuery
select case strChoice
case "choiceA"
'qrySelect in the db is: SELECT * from Employees
strQuery = "qrySelect"
objRS.Open strSQL, objConn
' stuff to deal with RecordSet
objRS.Close
case "choiceB"
'qryUpdate in the DB is UPDATE Employees SET status='Active' where available='Y'
strQuery = "qryUpdate"
objRS.Open strSQL, objConn
objRS.Close
end select
' clean up objRS and objConn
I can do this query outside the select case and it works fine. Any ideas???????