You need to sign in to do that
Don't have an account?
BOFH
Display Query Results C# .net
Hi all,
I'm new to developing with Sales Force, I just downloaded the Office Tool Kit, and am attempting to run a simple query that should return one record. I know the record exists, and I know the query is working, since when I run the code, it tells me I am getting one result back. Here is the C# code that I am running:
strSOQL = "Select Name FROM Account where accountnumber = 'xxxxx'"; //Where xxxxx is an account number
sfQry = sfObj.Query(strSOQL, sync);
//result testing
rslt = sfQry.Error.ToString();
Console.WriteLine("Error (if any): " + rslt);
Console.WriteLine("Result:");
count = sfQry.Size;
Console.WriteLine("Count: " + count);
rslt = sfQry.EntityType;
Console.WriteLine("Entity Type: " + rslt);
foreach (object obj in sfQry)
{
result = sfQry.ToString();
Console.WriteLine("Query Result: " + result);
}
This compiles and runs, when I run it, I get the following result:
Successfully Logged In
Error (if any): NO_SF_ERROR
Result:
Count: 1
Entity Type: account
Query Result: SForceOfficeToolkitLib3.QueryResultSet3Class
Press any key to exit...
I am wondering how to get the program to display the Name instead of printing out: SForceOfficeToolkitLib3.QueryResultSet3Class .
Any and all help is appreciated.
Thanks.
I'm new to developing with Sales Force, I just downloaded the Office Tool Kit, and am attempting to run a simple query that should return one record. I know the record exists, and I know the query is working, since when I run the code, it tells me I am getting one result back. Here is the C# code that I am running:
strSOQL = "Select Name FROM Account where accountnumber = 'xxxxx'"; //Where xxxxx is an account number
sfQry = sfObj.Query(strSOQL, sync);
//result testing
rslt = sfQry.Error.ToString();
Console.WriteLine("Error (if any): " + rslt);
Console.WriteLine("Result:");
count = sfQry.Size;
Console.WriteLine("Count: " + count);
rslt = sfQry.EntityType;
Console.WriteLine("Entity Type: " + rslt);
foreach (object obj in sfQry)
{
result = sfQry.ToString();
Console.WriteLine("Query Result: " + result);
}
This compiles and runs, when I run it, I get the following result:
Successfully Logged In
Error (if any): NO_SF_ERROR
Result:
Count: 1
Entity Type: account
Query Result: SForceOfficeToolkitLib3.QueryResultSet3Class
Press any key to exit...
I am wondering how to get the program to display the Name instead of printing out: SForceOfficeToolkitLib3.QueryResultSet3Class .
Any and all help is appreciated.
Thanks.
You may find the native .NET soap stack easier to work with from C# rather than the office toolkit.
You also mentioned using SOAP, could you direct me toward some helpful information on this. Such as, getting SOAP to interact with SalesForce?
Thanks a bunch.
Seriously - go for the SOAP API.
To get started have a look at the API docs there are good c# examples there. I reccomend starting using the Enterprise API.
Use Salesforce.com to download the WSDL (from setup->integrate) and the add that as a WebReference in you VS Project.
You won't regret it.
Cheers
Gareth.