473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

2nd Post - No Data in Recordset Field

I'm able to query an Access database on my server
(remote), and I can even successfully get the number of
records returned in my recordset. BUT when I try to
access a field value, I get an error indicating that an
instance is required (referring to the recordset).

Can anyone point me in a direction?

-------------------------

Dim sConn As String
= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
config.DBSource & ";Password=myPass;"
Dim conn As OleDbConnection = New OleDbConnection
(sConn)
conn.Open()

Dim strSQL As String = "Select TOP 1 * FROM
tblUsers WHERE Username = 1"
Dim objCommand As OleDbCommand = New OleDbCommand
(strSQL, conn)
Dim objDataReader As OleDbDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

System.Web.HttpContext.Current.Trace.Warn("field
value", objDataReader("ID"))
objDataReader.Close()
conn.Close()
Nov 18 '05 #1
1 948
You must use objDataReader.Read to position the pointer to the first record.
(Then you must use it again to advance to each subsequent record.)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"George Addison" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I'm able to query an Access database on my server
(remote), and I can even successfully get the number of
records returned in my recordset. BUT when I try to
access a field value, I get an error indicating that an
instance is required (referring to the recordset).

Can anyone point me in a direction?

-------------------------

Dim sConn As String
= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
config.DBSource & ";Password=myPass;"
Dim conn As OleDbConnection = New OleDbConnection
(sConn)
conn.Open()

Dim strSQL As String = "Select TOP 1 * FROM
tblUsers WHERE Username = 1"
Dim objCommand As OleDbCommand = New OleDbCommand
(strSQL, conn)
Dim objDataReader As OleDbDataReader =
objCommand.ExecuteReader(CommandBehavior.CloseConn ection)

System.Web.HttpContext.Current.Trace.Warn("field
value", objDataReader("ID"))
objDataReader.Close()
conn.Close()

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Randi | last post by:
Hi all, I have this project to use the ADODB control to acces and manipulate the Access DB. I amd the mistake of first doing this project with just the data control. It worked fine with this...
0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
2
by: JReed | last post by:
I need to run a query to get data from a SQL Server table and put the results into an Access Table. I would like to use a DNS less connection to SQL Server. I seem to have the DNS less part figured...
5
by: DBQueen | last post by:
I have a database where the user will have the opportunity to set up a number of Tests. I want the user to be able to enter the equation if a field for a particular test is to be a calculated...
0
by: lialie | last post by:
Hi~ I would like to save images in OLE field in Microsoft Access. It writes the binary data which read from an JPEG/BMP file. But seems I meet an encoding problem. The following code demos...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.