Search fields in CRM 2011 EntityReference, this means that you need to know the LogicalNameobject that the search points to and the Idrecords.
so your code will be as follows:
Account acc = new Account();
acc.Attributes["name"] = "Ram"; // this values got inserted
acc.Attributes["age"] = "22"; // this values got inserted
acc.Attributes["lookupfieldid"] = new EntityReference("contact", contactId); // if lookupfieldid is pointing to contact entity
service.Create(acc); // to create account
One consideration: you wrote
Account acc = new Account();
, ( , crmsvcutil.exe) ( Entity acc = new Entity("account");)
, :
Account acc = new Account();
acc.Name = "Ram"; // this values got inserted
acc.Age = "22"; // this values got inserted
acc.LookupFieldId = new EntityReference("contact", contactId); // if lookupfieldid is pointing to contact entity
service.Create(acc); // to create account
, , .