Linq to sql LINQ到SQL,在db.SubmitChanges()上失败

Linq to sql LINQ到SQL,在db.SubmitChanges()上失败,linq-to-sql,exception,insert-update,Linq To Sql,Exception,Insert Update,当我尝试更新时,我遇到了一个异常,Insert非常有效。。这就是: System.Data.Linq.dll中发生类型为“System.InvalidCastException”的第一次意外异常 另一个线索。。。是否可以先在一个表中插入,然后更新另一个表,最后在同一代码块中提交changes()? 我还评论InsertOnSubmit();我重建了dbml(删除并再次创建)更改了名称、上下文等。。 代码: 堆栈: System.InvalidCastException was caught

当我尝试更新时,我遇到了一个异常,Insert非常有效。。这就是: System.Data.Linq.dll中发生类型为“System.InvalidCastException”的第一次意外异常 另一个线索。。。是否可以先在一个表中插入,然后更新另一个表,最后在同一代码块中提交changes()? 我还评论InsertOnSubmit();我重建了dbml(删除并再次创建)更改了名称、上下文等。。 代码:

堆栈:

System.InvalidCastException was caught
  Message="No se puede convertir un objeto de tipo 'System.Int32' al tipo 'System.String'."
  Source="System.Data.Linq"
  StackTrace:
       en System.Data.Linq.IdentityManager.StandardIdentityManager.MultiKeyManager`3.TryCreateKeyFromValues(Object[] values, MultiKey`2& k)
       en System.Data.Linq.IdentityManager.StandardIdentityManager.MultiKeyManager`3.TryCreateKeyFromValues(Object[] values, MultiKey`2& k)
       en System.Data.Linq.IdentityManager.StandardIdentityManager.MultiKeyManager`3.TryCreateKeyFromValues(Object[] values, MultiKey`2& k)
       en System.Data.Linq.IdentityManager.StandardIdentityManager.MultiKeyManager`3.TryCreateKeyFromValues(Object[] values, MultiKey`2& k)
       en System.Data.Linq.IdentityManager.StandardIdentityManager.IdentityCache`2.Find(Object[] keyValues)
       en System.Data.Linq.IdentityManager.StandardIdentityManager.Find(MetaType type, Object[] keyValues)
       en System.Data.Linq.CommonDataServices.GetCachedObject(MetaType type, Object[] keyValues)
       en System.Data.Linq.ChangeProcessor.GetOtherItem(MetaAssociation assoc, Object instance)
       en System.Data.Linq.ChangeProcessor.BuildEdgeMaps()
       en System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
       en System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
       en System.Data.Linq.DataContext.SubmitChanges()
       en Demo.View.InformeMedico.btnGuardar_Click(Object sender, RoutedEventArgs e) en D:\cs_InformeMedico\app\InformeMedico.xaml.cs:línea 433
  InnerException:
感谢您的持续支持

XML:

<?xml version="1.0" encoding="utf-8"?>
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11.625, 14" name="DataClasses1">
  <DataContextMoniker Name="/DB" />
  <nestedChildShapes>
    <classShape Id="578a0699-bcf4-45c5-9bec-2beb667a6a06" absoluteBounds="5.75, 1.25, 2, 3.23266845703125">
      <DataClassMoniker Name="/DB/EXAMENXATENCION" />
      <nestedChildShapes>
        <elementListCompartment Id="10f26c82-1f06-45d2-9488-da3d7d92e231" absoluteBounds="5.7650000000000006, 1.71, 1.9700000000000002, 2.67266845703125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <classShape Id="1f3a6a96-bcc1-41c3-8d57-b9987a3cdec1" absoluteBounds="2.625, 2.875, 2, 1.4248478190104168">
      <DataClassMoniker Name="/DB/ESTUDIO" />
      <nestedChildShapes>
        <elementListCompartment Id="86092ab5-554b-402d-a8cf-938b89f4473e" absoluteBounds="2.64, 3.335, 1.9700000000000002, 0.86484781901041674" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(4.625 : 3.58742390950521); (5.75 : 3.58742390950521)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/ESTUDIO/ESTUDIO_EXAMENXATENCION" />
      <nodes>
        <classShapeMoniker Id="1f3a6a96-bcc1-41c3-8d57-b9987a3cdec1" />
        <classShapeMoniker Id="578a0699-bcf4-45c5-9bec-2beb667a6a06" />
      </nodes>
    </associationConnector>
    <classShape Id="e4ab888d-5eb4-4b81-a562-baa1ff7393f8" absoluteBounds="7.875, 5.625, 2, 2.5752791341145831">
      <DataClassMoniker Name="/DB/PACIENTE" />
      <nestedChildShapes>
        <elementListCompartment Id="239b98aa-995d-458c-b0e6-4211e108c99d" absoluteBounds="7.8900000000000006, 6.085, 1.9700000000000002, 2.015279134114583" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <classShape Id="516b8633-e8ba-43f7-bf23-8c18e055e9b4" absoluteBounds="1.625, 5, 2, 2.9039737955729166">
      <DataClassMoniker Name="/DB/ATENCION" />
      <nestedChildShapes>
        <elementListCompartment Id="c3ec622f-93e5-4418-bb4d-7903b46ac639" absoluteBounds="1.6400000000000001, 5.46, 1.9700000000000002, 2.3439737955729165" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(3.625 : 6.24307135546875); (4.07291666666667 : 6.24307135546875 : JumpStart); (4.23958333333333 : 6.24307135546875 : JumpEnd); (7.21875 : 6.24307135546875); (7.21875 : 4.48266845703125)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/ATENCION/ATENCION_EXAMENXATENCION" />
      <nodes>
        <classShapeMoniker Id="516b8633-e8ba-43f7-bf23-8c18e055e9b4" />
        <classShapeMoniker Id="578a0699-bcf4-45c5-9bec-2beb667a6a06" />
      </nodes>
    </associationConnector>
    <associationConnector edgePoints="[(7.875 : 7.5486477109375); (4.23958333333333 : 7.5486477109375 : JumpStart); (4.07291666666667 : 7.5486477109375 : JumpEnd); (3.625 : 7.5486477109375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/PACIENTE/PACIENTE_ATENCION" />
      <nodes>
        <classShapeMoniker Id="e4ab888d-5eb4-4b81-a562-baa1ff7393f8" />
        <classShapeMoniker Id="516b8633-e8ba-43f7-bf23-8c18e055e9b4" />
      </nodes>
    </associationConnector>
    <classShape Id="f479daef-94e3-451a-b060-f4644304ec8c" absoluteBounds="0.5, 0.5, 2, 2.4109318033854166">
      <DataClassMoniker Name="/DB/MEDICOEXTERNO" />
      <nestedChildShapes>
        <elementListCompartment Id="964d649c-c39e-48c6-b130-215c40080462" absoluteBounds="0.515, 0.96, 1.9700000000000002, 1.8509318033854165" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(2.0625 : 2.91093180338542); (2.0625 : 5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/MEDICOEXTERNO/MEDICOEXTERNO_ATENCION" />
      <nodes>
        <classShapeMoniker Id="f479daef-94e3-451a-b060-f4644304ec8c" />
        <classShapeMoniker Id="516b8633-e8ba-43f7-bf23-8c18e055e9b4" />
      </nodes>
    </associationConnector>
    <classShape Id="5ce0ebb2-391e-46de-b85c-c6a50434ea12" absoluteBounds="3.125, 0.5, 2, 1.26050048828125">
      <DataClassMoniker Name="/DB/FIRMA" />
      <nestedChildShapes>
        <elementListCompartment Id="a21918ee-6f48-470d-9f0e-a9160faab27e" absoluteBounds="3.1399999999999997, 0.96, 1.9700000000000002, 0.70050048828125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <classShape Id="8080f6a7-cd0f-4e38-a667-8aa34c40969e" absoluteBounds="5.375, 9, 2, 1.9178898111979166">
      <DataClassMoniker Name="/DB/PLANTILLA" />
      <nestedChildShapes>
        <elementListCompartment Id="b6606488-da97-4a5c-9204-1c1874f1fb29" absoluteBounds="5.39, 9.46, 1.9700000000000002, 1.3578898111979165" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <classShape Id="2ecb0a31-9312-4243-9d5a-dcecc886146c" absoluteBounds="1.375, 8.875, 2, 1.75354248046875">
      <DataClassMoniker Name="/DB/EQUIPO" />
      <nestedChildShapes>
        <elementListCompartment Id="b72b559d-fea0-4615-a2ac-08b4dc715230" absoluteBounds="1.3900000000000001, 9.335, 1.9700000000000002, 1.19354248046875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(3.375 : 8.90625); (4.07291666666667 : 8.90625 : JumpStart); (4.23958333333333 : 8.90625 : JumpEnd); (7.59375 : 8.90625); (7.59375 : 4.48266845703125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/EQUIPO/EQUIPO_EXAMENXATENCION" />
      <nodes>
        <classShapeMoniker Id="2ecb0a31-9312-4243-9d5a-dcecc886146c" />
        <classShapeMoniker Id="578a0699-bcf4-45c5-9bec-2beb667a6a06" />
      </nodes>
    </associationConnector>
    <classShape Id="8a332fc0-58f9-4d58-ae99-d84b9ef09d01" absoluteBounds="9.375, 10.5, 2, 3.23266845703125">
      <DataClassMoniker Name="/DB/INFORMEMEDICO" />
      <nestedChildShapes>
        <elementListCompartment Id="2696f44c-b32e-4a93-b012-c19292012a86" absoluteBounds="9.39, 10.96, 1.9700000000000002, 2.67266845703125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(9.625 : 8.20027913411458); (9.625 : 10.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/PACIENTE/PACIENTE_INFORMEMEDICO" />
      <nodes>
        <classShapeMoniker Id="e4ab888d-5eb4-4b81-a562-baa1ff7393f8" />
        <classShapeMoniker Id="8a332fc0-58f9-4d58-ae99-d84b9ef09d01" />
      </nodes>
    </associationConnector>
    <associationConnector edgePoints="[(4.15625 : 4.29984781901042); (4.15625 : 12.3565291341146); (9.375 : 12.3565291341146)]" fixedFrom="NotFixed" fixedTo="NotFixed">
      <AssociationMoniker Name="/DB/ESTUDIO/ESTUDIO_INFORMEMEDICO" />
      <nodes>
        <classShapeMoniker Id="1f3a6a96-bcc1-41c3-8d57-b9987a3cdec1" />
        <classShapeMoniker Id="8a332fc0-58f9-4d58-ae99-d84b9ef09d01" />
      </nodes>
    </associationConnector>
  </nestedChildShapes>
</ordesignerObjectsDiagram>

XML:ohooh:)



看起来您的数据库架构与DBML不匹配。仔细检查您的属性类型和属性是否匹配。

您的
示例中的
estadoStudio
字段是否为表a VarChar(1)?如果LINQ to SQL设计器已将其解释为Char字段,请将DBML设计器中的列或底层XML编辑为
System.String
,而不是
System.Char
。如果您在LINQ to SQL中表示的任何其他VarChar(1)字段可以为空,因为您不能有空字符,我也建议您使用该字段。

解决方案:

打开一个新项目,添加新的Linq2SQL模型,然后复制并粘贴XML和designer.cs文件,在此行重命名:

public DB() :
            base(global::SRIMedico.Properties.Settings.Default.DATABASEGENERALConnectionString, mappingSource)
        {
            OnCreated();
        }
其中SRIMedico将是您的默认命名空间。。。 DATABASEGENERALConnectionString将是您的ConnectionString名称


希望对您有所帮助

您能为INFORMEMEDICO表发布从DBML生成的XML吗?我最近遇到了类似的情况。您的一个外键不是关联表中的主键吗?我只是从服务器explorerwell拖放,用同一个WPF应用程序打开一个新项目,然后用一个按钮从数据库中更新表中的随机行,然后工作!这是一个bug吗?那么您只需要打开DBML设计器,单击数据库中定义为varchar(1)或nvarchar(1)的列,并将属性窗口中的类型从System.Char更改为System.StringBleh。。我应该更仔细地阅读你的错误消息。它说int32是字符串。你能用鼠标右键单击你的DBML并说“打开并选择XML查看器”,然后粘贴相关表的XML以及SQL定义,这样我们就可以看到不匹配的地方了吗?好的,也许这是一个错误,我在两个项目中都有相同的XML(在工作和不工作的项目中),我不能确认或否认这是一个错误,但我看不出有什么问题。希望您能将您的元素保存到正确工作的新项目中。
<?xml version="1.0" encoding="utf-8"?>
<Database Name="DATABASEGENERAL" EntityNamespace="Demo.View.Data" ContextNamespace="Demo.View" Class="DB" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
  <Connection Mode="AppSettings" ConnectionString="Data Source=192.168.0.3;Initial Catalog=DATABASEGENERAL;Integrated Security=True" SettingsObjectName="SRIMedico.Properties.Settings" SettingsPropertyName="DATABASEGENERALConnectionString1" Provider="System.Data.SqlClient" />
  <Table Name="dbo.EXAMENXATENCION" Member="EXAMENXATENCIONs">
    <Type Name="EXAMENXATENCION">
      <Column Name="codigo" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
      <Column Name="numeroatencion" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigopaciente" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="numerocita" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigocompaniaseguro" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="ruc" Type="System.String" DbType="Char(11) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigoequipo" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="horaatencion" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="codigoestudio" Type="System.String" DbType="Char(12) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigoclase" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigomodalidad" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigounidad" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="estadoestudio" Type="System.Char" DbType="Char(1) NOT NULL" CanBeNull="false" />
      <Column Name="prioridad" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
      <Column Name="turnomedico" Type="System.String" DbType="Char(5)" CanBeNull="true" />
      <Association Name="ATENCION_EXAMENXATENCION" Member="ATENCION" ThisKey="numeroatencion,codigopaciente,codigomodalidad,codigounidad,codigocompaniaseguro,ruc,numerocita" OtherKey="numeroatencion,codigopaciente,codigomodalidad,codigounidad,codigocompaniaseguro,ruc,numerocita" Type="ATENCION" IsForeignKey="true" />
      <Association Name="EQUIPO_EXAMENXATENCION" Member="EQUIPO" ThisKey="codigoequipo" OtherKey="codigoequipo" Type="EQUIPO" IsForeignKey="true" />
      <Association Name="ESTUDIO_EXAMENXATENCION" Member="ESTUDIO" ThisKey="codigoestudio,codigoclase" OtherKey="codigoestudio,codigoclase" Type="ESTUDIO" IsForeignKey="true" />
    </Type>
  </Table>
  <Table Name="dbo.ATENCION" Member="ATENCIONs">
    <Type Name="ATENCION">
      <Column Name="fechayhora" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="numeroatencion" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
      <Column Name="codigopaciente" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="cmp" Type="System.String" DbType="Char(6) NOT NULL" CanBeNull="false" />
      <Column Name="codigocompaniaseguro" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="ruc" Type="System.String" DbType="Char(11) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="numerocita" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigomodalidad" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigounidad" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="peso" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
      <Column Name="talla" Type="System.Single" DbType="Real NOT NULL" CanBeNull="false" />
      <Column Name="edad" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
      <Column Name="codigousuario" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
      <Association Name="ATENCION_EXAMENXATENCION" Member="EXAMENXATENCIONs" ThisKey="numeroatencion,codigopaciente,codigomodalidad,codigounidad,codigocompaniaseguro,ruc,numerocita" OtherKey="numeroatencion,codigopaciente,codigomodalidad,codigounidad,codigocompaniaseguro,ruc,numerocita" Type="EXAMENXATENCION" />
      <Association Name="PACIENTE_ATENCION" Member="PACIENTE" ThisKey="codigopaciente" OtherKey="codigopaciente" Type="PACIENTE" IsForeignKey="true" />
      <Association Name="MEDICOEXTERNO_ATENCION" Member="MEDICOEXTERNO" ThisKey="cmp" OtherKey="cmp" Type="MEDICOEXTERNO" IsForeignKey="true" />
    </Type>
  </Table>
  <Table Name="dbo.INFORMEMEDICO" Member="INFORMEMEDICOs">
    <Type Name="INFORMEMEDICO">
      <Column Name="numeroinforme" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigoestudio" Type="System.String" DbType="Char(12) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="turnosocio" Type="System.String" DbType="Char(5) NOT NULL" CanBeNull="false" />
      <Column Name="fechainforme" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="horainforme" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="tecnica" Type="System.String" DbType="VarChar(3000) NOT NULL" CanBeNull="false" />
      <Column Name="hallazgo" Type="System.String" DbType="VarChar(5000) NOT NULL" CanBeNull="false" />
      <Column Name="conclusion" Type="System.String" DbType="VarChar(3000) NOT NULL" CanBeNull="false" />
      <Column Name="impreso" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
      <Column Name="codigoclase" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigopaciente" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="medicoinforma" Type="System.String" DbType="Char(5) NOT NULL" CanBeNull="false" />
      <Column Name="firmados" Type="System.Data.Linq.Binary" DbType="Image" CanBeNull="true" UpdateCheck="Never" />
      <Column Name="firmauno" Type="System.Data.Linq.Binary" DbType="Image" CanBeNull="true" UpdateCheck="Never" />
      <Column Name="nombreinforme" Type="System.String" DbType="VarChar(150) NOT NULL" CanBeNull="false" />
      <Association Name="ESTUDIO_INFORMEMEDICO" Member="ESTUDIO" ThisKey="codigoestudio,codigoclase" OtherKey="codigoestudio,codigoclase" Type="ESTUDIO" IsForeignKey="true" />
      <Association Name="PACIENTE_INFORMEMEDICO" Member="PACIENTE" ThisKey="codigopaciente" OtherKey="codigopaciente" Type="PACIENTE" IsForeignKey="true" />
    </Type>
  </Table>
  <Table Name="dbo.EQUIPO" Member="EQUIPOs">
    <Type Name="EQUIPO">
      <Column Name="fechaadquirio" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="intensidad" Type="System.Single" DbType="Real NOT NULL" CanBeNull="false" />
      <Column Name="modelo" Type="System.String" DbType="VarChar(40)" CanBeNull="true" />
      <Column Name="marca" Type="System.String" DbType="VarChar(40) NOT NULL" CanBeNull="false" />
      <Column Name="nombreequipo" Type="System.String" DbType="VarChar(35) NOT NULL" CanBeNull="false" />
      <Column Name="codigoequipo" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Association Name="EQUIPO_EXAMENXATENCION" Member="EXAMENXATENCIONs" ThisKey="codigoequipo" OtherKey="codigoequipo" Type="EXAMENXATENCION" />
    </Type>
  </Table>
  <Table Name="dbo.ESTUDIO" Member="ESTUDIOs">
    <Type Name="ESTUDIO">
      <Column Name="nombreestudio" Type="System.String" DbType="VarChar(100) NOT NULL" CanBeNull="false" />
      <Column Name="codigoestudio" Type="System.String" DbType="Char(12) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigoclase" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="indicacion" Type="System.String" DbType="VarChar(500)" CanBeNull="true" />
      <Association Name="ESTUDIO_EXAMENXATENCION" Member="EXAMENXATENCIONs" ThisKey="codigoestudio,codigoclase" OtherKey="codigoestudio,codigoclase" Type="EXAMENXATENCION" />
      <Association Name="ESTUDIO_INFORMEMEDICO" Member="INFORMEMEDICOs" ThisKey="codigoestudio,codigoclase" OtherKey="codigoestudio,codigoclase" Type="INFORMEMEDICO" />
    </Type>
  </Table>
  <Table Name="dbo.PACIENTE" Member="PACIENTEs">
    <Type Name="PACIENTE">
      <Column Name="nacionalidad" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
      <Column Name="direccion" Type="System.String" DbType="VarChar(80)" CanBeNull="true" />
      <Column Name="email" Type="System.String" DbType="VarChar(60)" CanBeNull="true" />
      <Column Name="celular" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
      <Column Name="telefono" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
      <Column Name="fechanace" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Column Name="sexo" Type="System.Char" DbType="Char(1) NOT NULL" CanBeNull="false" />
      <Column Name="nombres" Type="System.String" DbType="VarChar(35) NOT NULL" CanBeNull="false" />
      <Column Name="apellidos" Type="System.String" DbType="VarChar(45) NOT NULL" CanBeNull="false" />
      <Column Name="dni" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
      <Column Name="codigopaciente" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Association Name="PACIENTE_ATENCION" Member="ATENCIONs" ThisKey="codigopaciente" OtherKey="codigopaciente" Type="ATENCION" />
      <Association Name="PACIENTE_INFORMEMEDICO" Member="INFORMEMEDICOs" ThisKey="codigopaciente" OtherKey="codigopaciente" Type="INFORMEMEDICO" />
    </Type>
  </Table>
  <Table Name="dbo.MEDICOEXTERNO" Member="MEDICOEXTERNOs">
    <Type Name="MEDICOEXTERNO">
      <Column Name="cmp" Type="System.String" DbType="Char(6) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="apellidos" Type="System.String" DbType="VarChar(45) NOT NULL" CanBeNull="false" />
      <Column Name="nombres" Type="System.String" DbType="VarChar(35) NOT NULL" CanBeNull="false" />
      <Column Name="telefono" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
      <Column Name="direccion" Type="System.String" DbType="VarChar(80)" CanBeNull="true" />
      <Column Name="email" Type="System.String" DbType="VarChar(60)" CanBeNull="true" />
      <Column Name="fechanacio" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
      <Column Name="codigoespecialidad" Type="System.Int32" DbType="Int" CanBeNull="true" />
      <Column Name="activo" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
      <Column Name="celular" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
      <Association Name="MEDICOEXTERNO_ATENCION" Member="ATENCIONs" ThisKey="cmp" OtherKey="cmp" Type="ATENCION" />
    </Type>
  </Table>
  <Table Name="dbo.PLANTILLA" Member="PLANTILLAs">
    <Type Name="PLANTILLA">
      <Column Name="codigoplantilla" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="codigoequipo" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
      <Column Name="codigoestudio" Type="System.String" DbType="Char(12) NOT NULL" CanBeNull="false" />
      <Column Name="tituloplantilla" Type="System.String" DbType="VarChar(150) NOT NULL" CanBeNull="false" />
      <Column Name="tecnica" Type="System.String" DbType="VarChar(3000) NOT NULL" CanBeNull="false" />
      <Column Name="hallazgo" Type="System.String" DbType="VarChar(5000) NOT NULL" CanBeNull="false" />
      <Column Name="conclusion" Type="System.String" DbType="VarChar(3000) NOT NULL" CanBeNull="false" />
    </Type>
  </Table>
  <Table Name="dbo.FIRMA" Member="FIRMAs">
    <Type Name="FIRMA">
      <Column Name="codigofirma" Type="System.String" DbType="VarChar(20) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="siglas" Type="System.String" DbType="Char(5) NOT NULL" CanBeNull="false" />
      <Column Name="imagen" Type="System.Data.Linq.Binary" DbType="Image NOT NULL" CanBeNull="false" UpdateCheck="Never" />
    </Type>
  </Table>
</Database>
public DB() :
            base(global::SRIMedico.Properties.Settings.Default.DATABASEGENERALConnectionString, mappingSource)
        {
            OnCreated();
        }