0

嘿,伙计们,从 matisse 对象数据库中检索记录时遇到问题,现在它得到了我...基本上尝试了一切,甚至使用计数消息框显示 linq 查询正在检索 1 个对象,但是当它出现 IConvertible 错误时应该可以工作,基本上我正在尝试编辑现有记录,但是它告诉我它需要是 IConvertible 但是这在使用 SQL 时会起作用,并且它也适用于使用 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();
    }
4

1 回答 1

0

持久类(如 Reptiles_Amphibians)必须包含在程序集中。

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

在 linq 查询之前

_db.SqlCurrentNamespace = "DataBaseNamespace";s
于 2013-07-19T06:12:16.373 回答