dbDAO, QueryDefs and SetValue Problems 
Author Message
 dbDAO, QueryDefs and SetValue Problems

We are running the following code using VC++5.0 and DAOSDK:

....
QueryDef = DataBase.QueryDefs[_T("MyQuery")];
QueryDef.Parameters[_T("MyParam")].SetValue(COleVariant(MyParam,
VT_I4));
....

a. First problem
----------------

if we use the following snippet to set another  'date' parameter (as
stated in the MS help)

QueryDef.Parameters[_T("MyDate")].SetValue(COleVariant("1/1/90",
VT_BSTRT);

then an exception will be raised, stating that the conversion cannot be
done.

b. second problem
-------------------

Whenever we access a QueryDef.Parameters[<any date-related
definition>].???? member, then the *next* QueryDef accesses will yield
an 'Access Violation' error. Those accesses are ok if we DO NOT access
to the date-related ones.

--> What are we doing wrong?
--> Is there any patch/bug for dbDAO 3.5 & VC++ 5.0?

--
-------------------------------------------------
Pierre Piraux, from MHC sa/nv ( http://www.*-*-*.com/ )

[ There is always time to do it again, but there
  was no time at all to do it right first...    ]



Fri, 15 Sep 2000 03:00:00 GMT  
 dbDAO, QueryDefs and SetValue Problems

        Can you use COleDateTime to create a date variable to represent the date
parameter.  If so, then you can do:

        COleDateTime dtParam(1990,1,1,0,0,0);           // The zeroes represent the time
portion
        QueryDef.Parameters[_T("MyDate")].SetValue(dtParam);

        Can you use MFC?  If so, you could get rid of the reliance on the DAO SDK.
 That would probably solve the second issue.



Quote:
> We are running the following code using VC++5.0 and DAOSDK:

> ....
> QueryDef = DataBase.QueryDefs[_T("MyQuery")];
> QueryDef.Parameters[_T("MyParam")].SetValue(COleVariant(MyParam,
> VT_I4));
> ....

> a. First problem
> ----------------

> if we use the following snippet to set another  'date' parameter (as
> stated in the MS help)

> QueryDef.Parameters[_T("MyDate")].SetValue(COleVariant("1/1/90",
> VT_BSTRT);

> then an exception will be raised, stating that the conversion cannot be
> done.

> b. second problem
> -------------------

> Whenever we access a QueryDef.Parameters[<any date-related
> definition>].???? member, then the *next* QueryDef accesses will yield
> an 'Access Violation' error. Those accesses are ok if we DO NOT access
> to the date-related ones.

> --> What are we doing wrong?
> --> Is there any patch/bug for dbDAO 3.5 & VC++ 5.0?

> --
> -------------------------------------------------
> Pierre Piraux, from MHC sa/nv (http://www.mhc.be)

> [ There is always time to do it again, but there
>   was no time at all to do it right first...    ]



Sat, 16 Sep 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem when setvalue to an MDB database

2. problem with file.SETVALUE("field",type)

3. dbDAO version problem

4. Problem with CdbDBEngine of dbDAO

5. DAO querydefs object

6. DAO QueryDefs objects

7. failing to close tabledefs, querydefs etc

8. RegistryKey.SetValue and null strings

9. SetValue with multidimensional array

10. Array.SetValue and COM interface

11. How To use CDynamicAccessor::SetValue() ?

12. How To use CDynamicAccessor::SetValue() ?

 

 
Powered by phpBB® Forum Software