Adodc : how to retrieve single value into EditBox
-
hi every body i am trying to retrieve a single value from Adodc into EditBox here i got an error :- m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName"); where "StockName" field of names in my table "Stocks" the error :- binary : '=' no right side takes class tagVariant , or no convertion available im working with "visual c++ 6 / mfc" dialog based project thank you in advance .
-
hi every body i am trying to retrieve a single value from Adodc into EditBox here i got an error :- m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName"); where "StockName" field of names in my table "Stocks" the error :- binary : '=' no right side takes class tagVariant , or no convertion available im working with "visual c++ 6 / mfc" dialog based project thank you in advance .
What is
m_edit1
?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
What is
m_edit1
?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic ;)
-
m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic ;)
I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content. In any case you need to extract (or convert to) a CString from the variant that you have as input.
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content. In any case you need to extract (or convert to) a CString from the variant that you have as input.
The good thing about pessimism is, that you are always either right or pleasently surprised.
an example would clear the case thanx .
-
an example would clear the case thanx .
If m_edit1 is a data member it would be something like that.
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();
If m_edit1 is a control member it would look like that instead.
m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());
In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
If m_edit1 is a data member it would be something like that.
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();
If m_edit1 is a control member it would look like that instead.
m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());
In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.
The good thing about pessimism is, that you are always either right or pleasently surprised.
i made it ,,, partially !! to inform you about my mdb file :- its name (inventory.mdb) it hase one table (Stocks) the fields are (StockName,StockID,...) now i can extract values from only the "StockName" which its string values by the following code in button click :-
m_ado.SetRecordSource ("SELECT * FROM Stocks");
m_ado.Refresh ();
C_Recordset m_Record = m_ado.GetRecordset ();// this line can be omitted !COleVariant var1;
var1.vt = VT_I2;
var1.iVal = 1;
COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
m_edit = value.bstrVal;UpdateData (FALSE);
how to extract the other values such as "StockID" which its integer or any other fields ? thanx .
-
i made it ,,, partially !! to inform you about my mdb file :- its name (inventory.mdb) it hase one table (Stocks) the fields are (StockName,StockID,...) now i can extract values from only the "StockName" which its string values by the following code in button click :-
m_ado.SetRecordSource ("SELECT * FROM Stocks");
m_ado.Refresh ();
C_Recordset m_Record = m_ado.GetRecordset ();// this line can be omitted !COleVariant var1;
var1.vt = VT_I2;
var1.iVal = 1;
COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
m_edit = value.bstrVal;UpdateData (FALSE);
how to extract the other values such as "StockID" which its integer or any other fields ? thanx .
coolerfantasy wrote:
how to extract the other values such as "StockID" which its integer or any other fields ?
See if this article is of any use.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
coolerfantasy wrote:
how to extract the other values such as "StockID" which its integer or any other fields ?
See if this article is of any use.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
thank you and thanx to all those posting my Question its solved .. :-D