无法将类型'int'隐式转换为'System.Data.DataTable'

维品

我正在尝试更新数据表中的某些字段。当使用下面给出的代码时,显示一个错误。帮助我找到适当的解决方案。谢谢你。

代码:

ShadingAnalysisDataSetTableAdapters.tbl_AutoAssignJrEngineersTeamTableAdapter tm;
tm = new ShadingAnalysisDataSetTableAdapters.tbl_AutoAssignJrEngineersTeamTableAdapter();
DataTable dt = new DataTable();
dt = tm.UpdateTeam(AssignedTeam,userName,DateTime.Now,ID); // error popup here

SQL:

UPDATE tbl_AutoAssignJrEngineersTeam 
SET Assigned_Team = @Assigned_Team, 
    Updated_By = @Updated_By, 
    Updated_Date = @Updated_Date 
WHERE (Id = @Id)

数据库:

在此处输入图片说明

蒂姆·施密特

TableAdapter-方法返回一个int是受影响的记录数,许多记录是如此的更新方式。但是,您正在将其分配给DataTable变量。

int updatedRows = tm.UpdateTeam(AssignedTeam,userName,DateTime.Now,ID);

你要么必须

  • 使用适当的GetData-或Fill(dt)TableAdapter中的方法再次加载表
  • 或更新表格中的行,并改用使用会对每行tm.Update(modifiedDataTable)执行UpdateCommandadapater的操作RowState=Modified

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

无法将类型'int'隐式转换为'ushort':已经显式转换

来自分类Dev

无法将类型'System.Data.EntityState'隐式转换为'System.Data.Entity.EntityState'。存在显式转换(您是否缺少演员表?)

来自分类Dev

无法将类型'System.Linq.IQueryable'隐式转换为'System.Data.Entity.DbSet'

来自分类Dev

无法将类型System.Data.Entity.Core.Objects.ObjectResult隐式转换为System.Data.Objects.ObjectResult

来自分类Dev

无法将类型int []隐式转换为int?[]

来自分类Dev

无法将类型'double'隐式转换为'int'。-错误

来自分类Dev

无法将类型'object'隐式转换为'System.Data.SqlClient.SqlParameter'。存在显式转换(您是否缺少演员表?)

来自分类Dev

连接字符串。无法将'String'隐式转换为'System.Data.SqlClient.SqlConnection'

来自分类Dev

无法将类型'int'隐式转换为'System.Collections.Generic.List <QuickTest.Stock>'

来自分类Dev

无法将类型“ void”隐式转换为“ int”?

来自分类Dev

无法将类型'System.Linq.IQueryable'隐式转换为'System.Data.Entity.Infrastructure.DbQuery'

来自分类Dev

无法将类型“ double”隐式转换为“ int”

来自分类Dev

无法将类型为“ System.Int32”的对象转换为类型为“ System.Data.DataRowView”的对象

来自分类Dev

无法将类型int []隐式转换为int?[]

来自分类Dev

无法将类型'System.Collections.Generic.List <System.Data.DataRow>'隐式转换为'System.Collections.Generic.List <string>'

来自分类Dev

隐式将int转换为double

来自分类Dev

无法将类型'double'隐式转换为'int'。-错误

来自分类Dev

无法将类型System.Data.SqlClient.SqlDataReader隐式转换为Microsoft.ReportingServices.DataProcessing.IDataReader

来自分类Dev

无法将方法组转换为非委托类型System.Data.Datatable

来自分类Dev

无法将类型隐式转换为int []

来自分类Dev

无法将类型字符串隐式转换为System.Func <string,int,string,string>

来自分类Dev

C#:错误-无法将类型'int'隐式转换为'System.Collections.Generic.IEnumerable <double>'

来自分类Dev

无法将类型'float'隐式转换为'int'

来自分类Dev

无法将“ System.Data.SqlClient.SqlDataReader”隐式转换为“ SqlDataReader.SqlDataReader”

来自分类Dev

无法将类型 system.Data.EnumerableRowCollectio 隐式转换为 System.collection.Generic.Ienumerable

来自分类Dev

无法将类型 'IEnumerable<int> 隐式转换为 'int'

来自分类Dev

错误“无法将类型“System.Collections.Generic.IEnumerable<int>”隐式转换为“System.Collections.Generic.List<int>”

来自分类Dev

如何解决无法将 System.Data.Datatable 隐式转换为 int 的问题?

来自分类Dev

无法将类型“字符串”隐式转换为“System.Collections.Generic.List<int>”

Related 相关文章

  1. 1

    无法将类型'int'隐式转换为'ushort':已经显式转换

  2. 2

    无法将类型'System.Data.EntityState'隐式转换为'System.Data.Entity.EntityState'。存在显式转换(您是否缺少演员表?)

  3. 3

    无法将类型'System.Linq.IQueryable'隐式转换为'System.Data.Entity.DbSet'

  4. 4

    无法将类型System.Data.Entity.Core.Objects.ObjectResult隐式转换为System.Data.Objects.ObjectResult

  5. 5

    无法将类型int []隐式转换为int?[]

  6. 6

    无法将类型'double'隐式转换为'int'。-错误

  7. 7

    无法将类型'object'隐式转换为'System.Data.SqlClient.SqlParameter'。存在显式转换(您是否缺少演员表?)

  8. 8

    连接字符串。无法将'String'隐式转换为'System.Data.SqlClient.SqlConnection'

  9. 9

    无法将类型'int'隐式转换为'System.Collections.Generic.List <QuickTest.Stock>'

  10. 10

    无法将类型“ void”隐式转换为“ int”?

  11. 11

    无法将类型'System.Linq.IQueryable'隐式转换为'System.Data.Entity.Infrastructure.DbQuery'

  12. 12

    无法将类型“ double”隐式转换为“ int”

  13. 13

    无法将类型为“ System.Int32”的对象转换为类型为“ System.Data.DataRowView”的对象

  14. 14

    无法将类型int []隐式转换为int?[]

  15. 15

    无法将类型'System.Collections.Generic.List <System.Data.DataRow>'隐式转换为'System.Collections.Generic.List <string>'

  16. 16

    隐式将int转换为double

  17. 17

    无法将类型'double'隐式转换为'int'。-错误

  18. 18

    无法将类型System.Data.SqlClient.SqlDataReader隐式转换为Microsoft.ReportingServices.DataProcessing.IDataReader

  19. 19

    无法将方法组转换为非委托类型System.Data.Datatable

  20. 20

    无法将类型隐式转换为int []

  21. 21

    无法将类型字符串隐式转换为System.Func <string,int,string,string>

  22. 22

    C#:错误-无法将类型'int'隐式转换为'System.Collections.Generic.IEnumerable <double>'

  23. 23

    无法将类型'float'隐式转换为'int'

  24. 24

    无法将“ System.Data.SqlClient.SqlDataReader”隐式转换为“ SqlDataReader.SqlDataReader”

  25. 25

    无法将类型 system.Data.EnumerableRowCollectio 隐式转换为 System.collection.Generic.Ienumerable

  26. 26

    无法将类型 'IEnumerable<int> 隐式转换为 'int'

  27. 27

    错误“无法将类型“System.Collections.Generic.IEnumerable<int>”隐式转换为“System.Collections.Generic.List<int>”

  28. 28

    如何解决无法将 System.Data.Datatable 隐式转换为 int 的问题?

  29. 29

    无法将类型“字符串”隐式转换为“System.Collections.Generic.List<int>”

热门标签

归档