dharkangel
MIS
Hi everyone,
I have a problem with an dynamic SQL statement I've created. I allow the user to choose an option via a CHECKBOX on an ASP page and submit. On the action page I wrote an SQL statement whose WHERE clause is filled in by the option the user chooses. It works fine, unless the user chooses an option that does not exist in the database yet. Then, I get an error that says: Object required:''
The error occurs at the .open statement in my code below. How can I capture this error before it gets to this point? If I can figure that out, then I can write an If statement that says if error exists, bypass this connection code.
with actionSet
.ActiveConnection = actionsDB
.Source = mySQL
.Open
End with
below is my SQL statement:
mySQL = "SELECT getBarcelonaBestPerformerData.Component AS Component, Count(getBarcelonaBestPerformerData.[Issue ID]) AS NumberOfActions, Round(Avg(getBarcelonaBestPerformerData.DaysToClose)) AS DaysToClose, Round(Avg(getBarcelonaBestPerformerData.DaysLate)) AS DaysLate"
'FROM
mySQL = mySQL & " FROM getBarcelonaBestPerformerData"
'WHERE
mySQL = mySQL & " WHERE getBarcelonaBestPerformerData.Component = '" & Request.QueryString("component") & "'"
mySQL = mySQL & " GROUP BY getBarcelonaBestPerformerData.Component;"
I have a problem with an dynamic SQL statement I've created. I allow the user to choose an option via a CHECKBOX on an ASP page and submit. On the action page I wrote an SQL statement whose WHERE clause is filled in by the option the user chooses. It works fine, unless the user chooses an option that does not exist in the database yet. Then, I get an error that says: Object required:''
The error occurs at the .open statement in my code below. How can I capture this error before it gets to this point? If I can figure that out, then I can write an If statement that says if error exists, bypass this connection code.
with actionSet
.ActiveConnection = actionsDB
.Source = mySQL
.Open
End with
below is my SQL statement:
mySQL = "SELECT getBarcelonaBestPerformerData.Component AS Component, Count(getBarcelonaBestPerformerData.[Issue ID]) AS NumberOfActions, Round(Avg(getBarcelonaBestPerformerData.DaysToClose)) AS DaysToClose, Round(Avg(getBarcelonaBestPerformerData.DaysLate)) AS DaysLate"
'FROM
mySQL = mySQL & " FROM getBarcelonaBestPerformerData"
'WHERE
mySQL = mySQL & " WHERE getBarcelonaBestPerformerData.Component = '" & Request.QueryString("component") & "'"
mySQL = mySQL & " GROUP BY getBarcelonaBestPerformerData.Component;"