some background: i normally program with asp and jsp is very new to me.
i'm trying to execute a query against a database, but for a given value off my webform.
This is the query right now:
ResultSet rsEnrolled = stmtEnrolled.executeQuery("Select EnrollDate, Count(Name) as Enrolled FROM Enrollment where EnrollDate = 2/1/2003 Group by EnrollDate"
But i want it to use a variable off my form in place of the actual date.
i tried using:
ResultSet rsEnrolled = stmtEnrolled.executeQuery("Select EnrollDate, Count(Name) as Enrolled FROM Enrollment where EnrollDate =" + varDate + " Group by EnrollDate"
but it really doesnt like that. the value of my form element is being stored in the variable varDate, but how do i use varDate in the query?
any and all suggestions would be greatly appreciated. thank you!
i'm trying to execute a query against a database, but for a given value off my webform.
This is the query right now:
ResultSet rsEnrolled = stmtEnrolled.executeQuery("Select EnrollDate, Count(Name) as Enrolled FROM Enrollment where EnrollDate = 2/1/2003 Group by EnrollDate"
But i want it to use a variable off my form in place of the actual date.
i tried using:
ResultSet rsEnrolled = stmtEnrolled.executeQuery("Select EnrollDate, Count(Name) as Enrolled FROM Enrollment where EnrollDate =" + varDate + " Group by EnrollDate"
but it really doesnt like that. the value of my form element is being stored in the variable varDate, but how do i use varDate in the query?
any and all suggestions would be greatly appreciated. thank you!