ADO Recordset's object method Open
From: Mad Hot dog (confbox_at_mail.ru)
Date: 04/06/04
- Next message: onedaywhen: "adSchemaConstraintTableUsage"
- Previous message: X.H.Qiu: "a problem of ADO access to Access DB"
- Next in thread: Stephen Howe: "Re: ADO Recordset's object method Open"
- Reply: Stephen Howe: "Re: ADO Recordset's object method Open"
- Messages sorted by: [ date ] [ thread ]
Date: 6 Apr 2004 02:02:19 -0700
Hello group!
I use MS Visual C++ 6.0, ADO, MS SQL Server 2000.
When I attempt to open my database I meet with a following problem:
when I try to get a bookmark of the current record in a Recordset
object a following run-time error occurs: Unhandled exception in
testdb.exe(KERNEL32.DLL):
0xE06D7363: Microsoft C++ Exception.
I created my database by 3 SQL commands:
create database testdb
create table testtable
(
i int
)
insert into testtable values(0)
The error occurs in the following code snippet:
#import "D:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
int main()
{
CoInitialize(NULL);
bstr_t strCnn("Provider=sqloledb;Data Source=;"
"Initial Catalog=testdb;Trusted_Connection=YES;");
const char* tablename = "testtable";
_RecordsetPtr recs;
recs.CreateInstance(__uuidof(Recordset) );
recs -> Open(tablename, strCnn, adOpenStatic,
adLockOptimistic,adCmdTable);
_variant_t bm = recs -> Bookmark; // the error occurs here
recs -> Close();
CoUninitialize();
}
During the debugging this code I met that the error depended on a type
of locking. When I set adLockBatchOptimistic or adLockOptimistic
or adLockPessimistic the error occurs but when I set adLockReadOnly or
adLockUnspecified it doesn't occur. By the way this error doesn't
occur when I open Pubs database with any type of locking. What is a
cause of this error?
Thank you.
- Next message: onedaywhen: "adSchemaConstraintTableUsage"
- Previous message: X.H.Qiu: "a problem of ADO access to Access DB"
- Next in thread: Stephen Howe: "Re: ADO Recordset's object method Open"
- Reply: Stephen Howe: "Re: ADO Recordset's object method Open"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|