Matisses Linq IConvertible Exception Matisse C#

171 views Asked by At

Hey Guys having a problem retrieiving a record from a matisse object database, and its getting to me now... basically tried everything and even using a count message box shows that the linq query is retrieving 1 object however im getting a IConvertible error when it should be working, basically im trying to edit the exisitng record, however its telling me it needs to be IConvertible however this would work when using SQL and it also works for others using Matisse.

db.Open();

        Zoo.Data.Zoo editanimals = new Zoo.Data.Zoo(db);

        var animalidvar = animalid.Text;
        {
          Reptiles_Amphibians f = (from  Reptiles_Amphibians a in editanimals.Reptiles_Amphibianss where a.Animal_ID == animalidvar select a).FirstOrDefault<Reptiles_Amphibians>();


            f.Animal_ID = animalid.Text;
            f.Species = species.Text;
            f.Classification = classif.Text;
            f.Given_Name = givenname.Text;
            f.Photograph = photograph.Text;
            f.Date_Of_Birth = Convert.ToDateTime(dob.Text);
            f.Age = Convert.ToInt32(age.Text);
            f.Location_Code = location.Text;
            f.Born_Captivity_Wild = borncw.Text;
            f.Special_Notes = specnote.Text;
            f.Date_Joined = Convert.ToDateTime(datejoined.Text);
            f.Animal_Dimensions_Upon_Join = duj.Text;
            f.Average_Animal_Dimension = ad.Text;
            f.Average_Life_Span = averagelife.Text;
            f.Dietary_Requirements = diet.Text;
            f.Natural_Habitat_Description = nathab.Text;
            f.Average_Number_Of_Offspring = Convert.ToInt32(averageOffspringTxt.Text);
            f.Reproduction_Type = reproductionTxt.Text;
            f.Average_Clutch_Size = clutchSizeTxt.Text;
            f.Status = statusCombo.Text;
            db.Commit();

        }
        db.Close();
    }
1

There are 1 answers

0
alxm On

Persisten classes (like Reptiles_Amphibians) must be contained in the assembly.

MtDatabase _db = new MtDatabase("localhost", "AnimalDB", new MtPackageObjectFactory("AssemblyName.AnimalsNamespace,AssemblyName", "DataBaseNamespace"));

And before linq query

_db.SqlCurrentNamespace = "DataBaseNamespace";s