Re: Cannot read data from Access 2007 database
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 9 Jan 2007 18:28:57 -0500
dbouthillier wrote:
if (SUCCEEDED(m_oRecordSet->Open("Select * FROM Table1",
A couple things to try:
Explicitly name the fields you want to return from Table1 instead of
using selstar (select * ). Make sure that if you have made the mistake
of using reserved keywords (such as "date") for your field names that
you surround them with brackets [] (better yet - go rename them) -
select [date], ...
Make sure you test the recordset's EOF property before attempting to
work with any data
m_oDatabase.GetInterfacePtr(), adOpenDynamic, adLockOptimistic,
adCmdText))) {
if (SUCCEEDED(m_oRecordSet->MoveFirst()))
This is unnecessary - if the recordset contains records, it will already
be pointing at the first record upon opening. You should be testing for
EOF at this point
{
_variant_t value =
m_oRecordSet->Fields->GetItem("DATE")->Value; }
You should not have to use brackets around DATE here - only in the sql
statement.
If you still have problems, loop through the Fields collection and make
sure the field names are what you expect them to be.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Prev by Date: Re: Cannot read data from Access 2007 database
- Next by Date: Retrieve Cyrillic data
- Previous by thread: Re: Cannot read data from Access 2007 database
- Next by thread: Re: Cannot read data from Access 2007 database
- Index(es):
Relevant Pages
|
|