Hey all,
For a university project i'm being forced to use Visual Studio Web Developer and ASP - I'm hating it so far!
My latest problem is running a query. When running the page I get:
The debugger highlights the line
Now here's the interesting bit... it only comes up with that error for this query:
If I run this query it works fine:
I've tested both queries in the database and they both run fine. Can anyone shed any light as to what's going wrong?
Here's the code:
For a university project i'm being forced to use Visual Studio Web Developer and ASP - I'm hating it so far!
My latest problem is running a query. When running the page I get:
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
The debugger highlights the line
Code:
rs.open(strSQL, conn)
Code:
SELECT DISTINCT coremodules.course, users.first_name, users.last_name FROM users INNER JOIN (teachers INNER JOIN ((modules INNER JOIN coremodules ON modules.ID = coremodules.module) INNER JOIN teachermodules ON modules.ID = teachermodules.module) ON teachers.ID = teachermodules.teacher) ON users.ID = teachers.uid WHERE (((coremodules.course)=1
If I run this query it works fine:
Code:
SELECT users.first_name, users.last_name FROM users
I've tested both queries in the database and they both run fine. Can anyone shed any light as to what's going wrong?
Here's the code:
Code:
<%
Dim strConnection As Object
Dim conn As Object
Dim strSQL As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(".\App_Data\Database.mdb")
conn = Server.CreateObject("ADODB.Connection")
conn.Open(strConnection)
Dim rs As Object
rs = Server.CreateObject("ADODB.recordset")
strSQL = "SELECT DISTINCT coremodules.course, users.first_name, users.last_name FROM users INNER JOIN (teachers INNER JOIN ((modules INNER JOIN coremodules ON modules.ID = coremodules.module) INNER JOIN teachermodules ON modules.ID = teachermodules.module) ON teachers.ID = teachermodules.teacher) ON users.ID = teachers.uid WHERE (((coremodules.course)=1))"
'strSQL = "SELECT users.first_name, users.last_name FROM users"
rs.open(strSQL, conn)
While Not rs.EOF
Response.Write(rs.Fields("first_name").value)
rs.moveNext()
End While
conn.Close()
conn = Nothing
%>