Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.database > #11
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin3!goblin.stu.neva.ru!exi-in1.telstra.net!news.telstra.net!61.9.128.156.MISMATCH!viwinnwcl01.internal.bigpond.com!viwinnwfe02.internal.bigpond.com.POSTED!7564ea0f!not-for-mail |
|---|---|
| From | Jason Keats <jkeats@melbpcDeleteThis.org.au> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Firefox/6.0.2 SeaMonkey/2.3.3 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.basic.visual.database |
| Subject | Re: ADODB.Recordset inaccessible |
| References | <j4qgih$emi$1@dont-email.me> |
| In-Reply-To | <j4qgih$emi$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 69 |
| Message-ID | <LUYcq.2559$7r4.1754@viwinnwfe02.internal.bigpond.com> (permalink) |
| Date | Sat, 17 Sep 2011 18:30:34 +1000 |
| NNTP-Posting-Host | 124.176.146.221 |
| X-Complaints-To | abuse@bigpond.net.au |
| X-Trace | viwinnwfe02.internal.bigpond.com 1316248235 124.176.146.221 (Sat, 17 Sep 2011 18:30:35 EST) |
| NNTP-Posting-Date | Sat, 17 Sep 2011 18:30:35 EST |
| Organization | BigPond |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.database:11 |
Show key headers only | View raw
The Dubious Khelair wrote:
> 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
>
You can use a disconnected ADODB.Recordset, if you wish, within
(ASP).NET - but you haven't provided a good reason for doing so. It
would be much easier to use ADO.NET to retrieve a DataTable.
However, if you must use ADODB, there's no reason to use late binding.
You should create a reference to Microsoft ActiveX Data Objects 2.8
Library. If you then use correctly typed objects, you get feedback via
intellisense - making it much less likely to make mistakes.
Back to comp.lang.basic.visual.database | Previous | Next — Previous 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