试图摆脱我的Datagrid中的视觉(无效). [英] Trying to get rid of visual (null) in my Datagrid.

查看:45
本文介绍了试图摆脱我的Datagrid中的视觉(无效).的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT LedgerKey ,
    ISNULL(CAST(TransactionDate AS varchar), '''') AS TransactionDate,
    ISNULL(Description, '''') AS Description,
    ISNULL(PostRef, '''') AS PostRef,
    ISNULL( CAST(Debit AS varchar) , '''') AS Debit,
    ISNULL(CAST (Credit  AS varchar)  , '''') AS Credit
    FROM LedgerCopy





从SQL查询管理器运行时,上面的查询确实从我的sqltable中删除了null;但是,当我尝试从C#VS环境运行SqlBulkCopy时.我
得到一个
InvalidOperationException未处理. 下面的文字.

数据源中String类型的给定值不能转换为指定目标列的十进制类型.


它在此语句上发生(sbc.WriteToServer(rdrLoadTable);)如果有人有任何想法,我将不胜感激.谢谢.





The query above does remove the null from my sqltable when run from SQL query manager; however, when I try to run a SqlBulkCopy from the C# VS environment. I
get an
InvalidOperationException was unhandled. With the wording below.

The given value of type String from the data source cannot be converted to type decimal of the specified target column.


It happens on this statement(sbc.WriteToServer(rdrLoadTable);) If anyone has any Ideas I would appreciate any feedback. Thankyou.

推荐答案

尝试将所有非字符串转换为字符串-列类型必须与从查询返回的所有行保持一致. />
最好的问候
Espen Harlinn
Try casting all non-strings to strings - the column type has to be consistent for all the rows returned from the query.

Best Regards
Espen Harlinn


这篇关于试图摆脱我的Datagrid中的视觉(无效).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆