将字符串转换为整数时出现问题 [英] Problem in converting string to integer
本文介绍了将字符串转换为整数时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好..
我正在使用查询生成器来生成用于报表目的的查询.我面临的问题是我无法在查询生成器中将字符串转换为整数.
请告诉我该怎么做?
我尝试了
Hi all..
I am using query builder to build a query for reporting purpose. The problem that i am facing is that i am unable to cast string to integer inside query builder.
please tell me how to do this??
i tried
WHERE ((unqId = CONVERT(int, @unqId))
我也尝试过
i also tried
where (unqId = (int)@unqId)
我也尝试过
i also tried
Where (unqId= Int.Parse(@unqId))
但每次显示错误或值为空
但是,如果我删除where子句,它将按预期显示整个报告..
but every time it''s showing me either error or null value
however if i remove the where clause it''s showing me the whole report as expected..
推荐答案
WHERE UNQID = @UNQID
在参数化查询中
In the parametrized query
oCommand.Parametrized.AddWithValue("@UNQID",Convert.Int32(string_name));
这篇关于将字符串转换为整数时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文