Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I use SQL in VC++ to operate an Access tables, functions such as sin(), are OK!

The code:

"Update tablename set Result=POWER(2,2)" IS wrong!
DEBUG:
m_pszMsg 0x001774b0 "IDispatch error #3092"
m_strErrorDescription "Express 'power' Function undefined"

Is there anybody to tell me how can make the functions workable. Please.
(Sorry for my poor English!Again!)
You may check this site if you know Chinese.

http://topic.csdn.net/u/20091129/10/76911454-a507-4359-9def-09887e5d70f1.html[^]
Posted
Updated 1-Dec-09 5:58am
v4

Have you tried:
SQL
UPDATE TableName SET Result = 2 ^ 2
 
Share this answer
 
v2
So, what you really want to do is call VBA functions from MS Access queries? This page explains how to do that.
 
Share this answer
 
I don't really follow you. If you want to use a VBA function in an Access query, just create your own UDF that wraps that VBA function, then you can use that UDF in your Access query. And if you want to use some Access query function from VC++, you can make database calls to an Access DB from VC++. Are you saying you want to use VC++ functions from an Access query? If so, I do not know if that can be done (although I imagine that too can be done by going through VBA as an intermediary).
 
Share this answer
 
Thanks to "aspdotnetdev"
2^2 is OK.
But how about LN()?It still doesn't work.And other functions?
The core of my question is "How to use functions embeded(inner?) Access 2003 such as "POWER(),LN()",while using VC++ to operate Access DataBase?"
I have check some chinese sites,as if there is no method to solve it.In fact these functions are embeded in Access2003,one can use it by VBA.But HOW?
Thank you again!
 
Share this answer
 
Thanks again!
I'ii read it carefully right now!
 
Share this answer
 
After having read for a long time,I don't know how to use VBA in my VC++ program!
Will you plea tell me how to do it?
Sorry for my much questions!
Thanks to "aspdotnetdev" Again. :-D
 
Share this answer
 
After "aspdotnetdev"'s telling.
I get to know that,there is no way for my original question.One must writes his own code to get the functions in VC++ after querying from access table the values of some fields.
Good Luck! "aspdotnetdev"!
yours sincerly.
 
Share this answer
 
v3
Finally,I find that the functions used while using VC++ to operate Access DataBase with ADO are the same in ASP.And all the elementary mathmatics functions can be used.
(For example:
power()->"^";ln()->"log()")
Thanks!!!
 
Share this answer
 
v3
VB
Finally,I find that the functions used while using VC++ to operate Access DataBase with ADO are the same in ASP.And all the elementary mathmatics functions can be used.
(For example:
power()->"^";ln()->"log()")
Thanks!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900