[libRETS-users] Last try at City Name
Mark Klein
mklein at dis.com
Fri Jun 1 19:12:26 CDT 2007
On Jun 1, 2007, at 3:19 PM, Robert Burdick wrote:
> Hello All:
>
>
>
> I cannot believe how incredible hard RETS makes it to get a city
> name. Id I have a CityID, I am executing this code
>
>
>
> mSession = new RetsSession("http://bc.reilrets.com:
> 6103/");
>
> if (mSession != null)
>
> {
>
> string search = "(CityID=" + mtbCityID.Text.Trim
> () + ")";
>
> bResult = mSession.Login("listsuite2",
> "l157beta");
>
> SearchRequest req = mSession.CreateSearchRequest
> ("city", "city","(CityID=58)");
>
> SearchResultSet res = mSession.Search(req);
>
>
Looks like you need to set standard names to false and then it should
work. I got the same results you did by using all defaults.
This worked for me:
#include "librets.h"
#include <iostream>
using namespace librets;
using std::cout;
using std::cerr;
using std::endl;
int main(int argc, char * argv[])
{
try
{
RetsSessionPtr session(
new RetsSession("http://bc.reilrets.com:6103/"));
session->Login("listsuite2", "l157beta");
SearchRequestAPtr searchRequest(
new SearchRequest("City", "City",
"(CityCode=.ANY.)"));
searchRequest->SetStandardNames(false);
SearchResultSetAPtr results = session->Search
(searchRequest.get());
while (results->HasNext())
{
cout << "City ID : " << results->GetString("CityID")
<< endl;
cout << "City code: " << results->GetString("CityCode")
<< endl;
cout << "City Name: " << results->GetString("CityName")
<< endl;
cout << "State code: " << results->GetString
("StateCode") << endl;
cout << endl;
}
session->Logout();
}
catch (RetsException & e)
{
e.PrintFullReport(cerr);
}
}
>
>
> I get an error saying that CityID is not a valid query field.
> However, this query works from a browser:
>
>
>
> http://pure.reilrets.com:6103/Search.ashx?
> QueryType=DMQL2&Class=city&Format=COMPACT&SearchType=city&Query=
> (CityID=58)
>
>
>
> can someone PLEASE tell me how to do this with librets.NET?
>
> _______________________________________________
> libRETS-users mailing list
> libRETS-users at crt.realtors.org
> http://mail.crt.realtors.org/mailman/listinfo/librets-users
--
Mark Klein
PGP Key Available
www.dis.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.crt.realtors.org/pipermail/librets-users/attachments/20070601/5f7eb89b/attachment.html
More information about the libRETS-users
mailing list