如何解决关于更新database时,identity的问题
在dataset中,存在一个Project(dataTable),Project 表对应数据库中Project(Table),
dataTable Project结构是 <xs:element name="Project">
<xs:complexType>
<xs:sequence>
<xs:attribute name="id" type="xs:nonPositiveInteger" />
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="path" type="xs:string" />
</xs:sequence> </xs:complexType>
</xs:element>
即:Project(id nonPositiveInteger,name string,path string);
SQL Server 2000 Table Project 结构如下"
Project(id uniqueidentifier,name nchar 50,path nchar 50);
在da(SqlDataAdapter).update(ds,"Project")
时,出现
An unhandled exception of type 'System.InvalidCastException' occurred in system.data.dll
Additional information: Invalid cast from System.Int64 to System.Guid.
我使用了SqlCommandBuild,在SqlDataAdapter 对象da的selectCommand中也包含了主键id,而且我也试过设置datatable project的id Column的MissingSchemaAction=AddwithKey,
都不能解决identity的问题,请高手相助!