Met*_*hor 1 c# ssis c#-4.0 ssis-2012
我在以下行获得了无效的强制转换异常:
DestMinSeq = (long)rdr["MinSeq"];
Run Code Online (Sandbox Code Playgroud)
当我更改查询以将MinSeq强制转换为BIGINT而不是INT时,它可以工作.
问题:为什么短期投票是违法的?
环境:
VS 2012 SSIS project script task.
ADO.NET connection manager.
SQL Server 2012.
Run Code Online (Sandbox Code Playgroud)
问题:为什么短期投票是违法的?
你试图将一个盒装短片投入很长时间.你可以在没有数据库的情况下看到:
int x = 10;
object o = x;
long y = (long) o; // Bang!
Run Code Online (Sandbox Code Playgroud)
如果你在拆箱时转换为正确的类型,然后转换为你真正想要的类型,那很好:
DestMinSeq = (long)(int)rdr["MinSeq]";
Run Code Online (Sandbox Code Playgroud)
(我怀疑你想要int而不是short,但你必须检查.)