Problem with SQL in ASP.NET (IError)
Posted on 2005-05-07
I'm writing a quick webpage which allows the user to run a number of queries. It relies on the querystring which designates an appropriate SQL string. 3 out of these 5 queries work. Two of them do not. Now, because I've got unlimited points, I'm going to open up a question for the other one. I've searched on the net for this problem but the error itself is really unusual and doesn't really help me much.
Here is the SQL string which I have used to create the query.
Else if ((Request.QueryString("delegate") = "chair")) Then
SQLstring = "chair"
SQL = "SELECT tblDelegate.DelegateName, tblDelegate.DelegateAffiliation, tblSession.SessionID,
tblSession.SessionDate, tblSession.Session, tblRegister.Role FROM tblSession INNER JOIN (tblDelegate INNER JOIN tblRegister ON tblDelegate.DelegateID = tblRegister.DelegateID) ON tblSession.SessionID = tblRegister.SessionID WHERE (((tblRegister.Role)=3))"
Along with the db connection stuff...
Dim dbconn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("delegates.mdb"))
Dim Cmd As OleDbCommand = New OleDbCommand(SQL,dbconn)
Dim reader As OleDbDataReader
reader = Cmd.ExecuteReader() <------- This line generates an error (IErrorInfo.GetDescription failed with E_FAIL(0x80004005)).
Binding the datasource here:
Else If (SQLstring = "chair") Then
chair.DataSource = reader
And finally, the output:
<% Else If ((Request.QueryString("delegate") = "chair")) %>
<asp:DataList id="chair" runat="server" width="80%">
As said before, this code generates the following error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
With this line:
reader = Cmd.ExecuteReader()
Anyone got any ideas on how to stop this? I've looked for help on the error but to no avail.
Thanks in advance.