Groups | Search | Server Info | Login | Register
Groups > comp.lang.basic.visual.database > #7
| From | The Dubious Khelair <khelair@contract.gateway.2wire.net> |
|---|---|
| Newsgroups | comp.lang.basic.visual.database |
| Subject | ADODB.Recordset inaccessible |
| Date | 2011-09-14 15:17 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <j4qgih$emi$1@dont-email.me> (permalink) |
I am working on a project here that has me working with a
Microsoft SQL database being accessed from an ASP.NET VB page. Up to
this point I haven't had any problems connecting to the database;
however, when I attempt to access what is a valid query in the query
builder, I am not able to see my ADODB.Recordset object's properties or
methods as far as I can tell. This may well be a very foolish mistake,
as I'm relatively new at Visual Basic and ASP.NET development as a
whole.
Anyway, here is some of the applicable code from which I am
getting the following error: Exception Details:
System.Runtime.InteropServices.COMException: Item cannot be found in the
collection corresponding to the requested name or ordinal.
It is being raised by the following line of code:
lblDebugResults.Text = objRecSet(0)
which is found in the following procedure:
-=-=-=-=-
Protected Sub btnQueryDB_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles btnQueryDB.Click
Dim strConn, sqlTemp As String
Dim objConn, objRecSet
objConn = Server.CreateObject("ADODB.Connection")
objRecSet = Server.CreateObject("ADODB.Recordset")
'credentials
strConn = <THIS IS OMITTED BUT FULLY DEBUGGED>
objConn.Open(strConn)
sqlTemp = "SELECT (Fname, Lname, Employed) FROM " & _
Student_Employment" '& _
' "WHERE ProgramMajor = " & _
ddlMajorSelection.SelectedItem.ToString
Try
objRecSet = objConn.execute(sqlTemp)
objConn.close()
Catch ex As Exception
'error running query- do something about it here
lblDebugResults.Text = "Error: " & ex.ToString
End Try
'relocate this code once it is debugged properly
lblDebugResults.Text = objRecSet(0)
End Sub
-=-=-=-=-
As you can see I've tried to simplify the query for debugging,
but I'm pretty sure now that the problem is in how I've declared the
ADODB.Recordset or how I'm trying to access it. After I put in
objRecSet. the menu which appears only gives me the default items, not
any ADODB.Recordset specific methods or properties.
Any help with this matter would be very greatly appreciated, and
I thank you much in advance for taking a peek at this.
-Damon Getsman
Back to comp.lang.basic.visual.database | Previous | Next — Next in thread | Find similar
ADODB.Recordset inaccessible The Dubious Khelair <khelair@contract.gateway.2wire.net> - 2011-09-14 15:17 +0000
Re: ADODB.Recordset inaccessible The Dubious Khelair <khelair@contract.gateway.2wire.net> - 2011-09-14 15:26 +0000
Re: ADODB.Recordset inaccessible The Dubious Khelair <khelair@contract.gateway.2wire.net> - 2011-09-15 10:55 +0000
Re: ADODB.Recordset inaccessible The Dubious Khelair <khelair@contract.gateway.2wire.net> - 2011-09-16 12:54 +0000
Re: ADODB.Recordset inaccessible Jason Keats <jkeats@melbpcDeleteThis.org.au> - 2011-09-17 18:30 +1000
csiph-web