如何解决关于更新database时,identity的问题

SherryLiu 2002-07-02 03:25:12
在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的问题,请高手相助!
...全文
95 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
daehappy 2002-07-09
  • 打赏
  • 举报
回复
up!gz!
johnsonrao 2002-07-08
  • 打赏
  • 举报
回复
帮你提一提!

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧