function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MingChang.HouMingChang.Hou 

abou QueryResultSet3

I try to use the query function as follow ...
 
                SForceOfficeToolkitLib3.QueryResultSet3 qrs;
                qrs = g_sfApi.Query("Select Id from account where Name = 'test'", false);  
                //where g_sfApi is SForceOfficeToolKitLib3.SForceSession3()
 
                SForceOfficeToolkitLib3.SObject3 qr;
                qr = qrs;    --------> this will be fail .... "It can't transfer SForceOfficeToolkitLib3.QueryResultSet3 type to SForceOfficeToolkitLib3.SObject3"
 
I dump the qrs value, I got the follow information.
    qrs.EntityType = "account";
    qrs.Error = NO_SF_ERROR;
    qrs.ErrorMessage = null
    qrs.Size = 1;
    qrs.Tag = null;
 
Has any method that I could get the query result?
 
I'm using vs .net 2005 to program.
 
werewolfwerewolf
Are you actually using a .net language or are you using C++?
werewolfwerewolf
If you're using a .net language like VB.NET or C# you don't need to use the office toolkit.  Just add the WSDL as a Web Reference (for C# have a look at the C# Quick Start in the wiki on developer.force.com).  It'll be much easier for you.


Message Edited by werewolf on 05-22-2008 06:39 PM
MingChang.HouMingChang.Hou
dear werewolf  thanks your reply...
 
I am using .net C# language and I know when using WSDL as a web Reference is no problem...
 
Because the WSDL  as web reference can't access the professional edition version ....
 
So, I try to find other solution to let the professional edition version can access to server through the client API...
 
by the way, about my question I have got the solution...
 
If everyone have the same problem, you can reference my same code...
 
 
                string fdAccount;
                string fdAllAccount;
                SForceOfficeToolkitLib3.QueryResultSet3 qrs;                
                qrs = g_sfApi.Query("Select Id from account", false);
                if (qrs.ErrorMessage != null)
                {
                }
                else
                {
                    foreach (SForceOfficeToolkitLib3.SObject3 qr in qrs)
                    {
                        m_fdAccount = null;
                        m_fdAccount = qr.Item("Id").Value.ToString();
                        m_fdAccount += "\n";
                        m_fdAllAccount += m_fdAccount;
                    }                   
                    System.Windows.Forms.MessageBox.Show((m_fdAllAccount);
                }
 
because the sample code of the Office ToolkitDeveloper’s Guide is VBA like
 
                Public Function Query()
                      Dim qr As QueryResultSet3
                      Dim v As Variant
                      Dim s As SObject3
                      Set qr = g_sfApi.Query("select * from task", False)
                      For Each v In qr
                         'loop through the results
                         'cast to a sobject3 to see more helpful debug info
                         Set s = v
                         'use the object
                         s("Name") = "Query"
                         's.Update
                       Next v
                  End Function
 
so, we just transfer VBA statement to C# statement...
VBA statement :
For Each element [ As datatype ] In groupstatements ]
    [ Exit For ]
    [ statements ]
Next [ element ]
C# statement :
foreach([As datatype] element in group){
 [statements]
}
 
SuperfellSuperfell
The office toolkit will not give you any more access than using the C# soap stack directly.

Professional Edition does not included API access. If you build a certified partner application, you can get a token that enabled API access for PE accounts for your application. None of this requires you to use the office toolkit.