none
Error 20 The type or namespace name 'Medication' does not exist RRS feed

  • Question

  • I am creating a page to add medication entry to MS HealthVault. I have this statement giving me error: Medication med = new Medication();
    "Error    20    The type or namespace name 'Medication' does not exist in the namespace 'Microsoft.Health.ItemTypes' (are you missing an assembly reference?)    C:\Documents and Settings\.....\
    "
    I have the the following using statements:
    using Microsoft.Health;
    using Microsoft.Health.Web;
    using Microsoft.Health.ItemTypes;

    Please let me know what is missing?
    Deep
    Tuesday, May 12, 2009 3:26 PM

Answers

  • I think there is a version mismatch in the dlls you are using. Are all the dlls you use from the same version of SDK?
    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    Wednesday, May 13, 2009 4:14 PM

All replies

  • Try adding a reference to the Microsoft.Health.ItemTypes.dll and then recompile

    Raj


    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    Tuesday, May 12, 2009 4:25 PM
  • I already have using Microsoft.Health.ItemTypes on top. I hv used several other ItemTypes on other pages.
    ex:        HbA1C HBA1C = new HbA1C(new HealthServiceDateTime(HBA1CTestDate), percentHBA1C);

    the above example works fine on medication page too, but "Medication med = new Medication();" does not work
    ??

    If I add reference to Microsoft.Health.ItemTypes.dll the previous error about Medication namespace goes away, but I start getting this error:

    "

    Could not load file or assembly 'Microsoft.Health, Version=0.13.1864.3516, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    "

    Thanks.


    Deep
    • Edited by DKaur Wednesday, May 13, 2009 3:49 PM
    Wednesday, May 13, 2009 3:43 PM
  • using statement is not equivalent to adding a reference.

    Right click on your project, and select Add reference and select the Microsoft.Health.ItemTypes.dll

    Recompile

    Raj
    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    Wednesday, May 13, 2009 3:48 PM
  • If I add reference to Microsoft.Health.ItemTypes.dll the previous error about Medication namespace goes away, but I start getting this error on every page, even the ones like cholestrol, HBA1C, BP, BloodGlucose etc. that were working earlier.

    "

    Could not load file or assembly 'Microsoft.Health, Version=0.13.1864.3516, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    "

    Thanks.
    Deep
    Wednesday, May 13, 2009 3:52 PM
  • I think there is a version mismatch in the dlls you are using. Are all the dlls you use from the same version of SDK?
    Raj HealthVault Developer Tool http://xray.getrealconsulting.com
    Wednesday, May 13, 2009 4:14 PM
  • Dkaur,

    Please use the following Sample Code..

    CodableValue codableValue = new CodableValue("My Medication");
                Name name = new Name("Vaithilingam Thirumalaikani", "Vaithilingam", "", "Thirumalaikani");
                Medication medication = new Medication();
                PersonItem personItem = new PersonItem(name);           
                personItem.Organization = "IRIS Software";
                Prescription prescription = new Prescription(personItem);
                medication.Name = codableValue;
                PersonInfo.SelectedRecord.NewItem(medication);

    Hope this helps.

    Let me know if you need more details.

    Thanks!

    Vaithi.
    Friday, May 15, 2009 6:06 AM