高手赠教:sql数据库中的int型字段怎么和vb.net的整型变量比较大小???
我用的查询字符串是:
strcom = "select name from dbo.sysobjects where nf_Pub cast(substring(name,8,2) as int)>=" + CType(month1, Int16) + " and cast(substrin(name,8,2) as int)<=" + CType(month2, Int16) + "' and type='U'"
其中,substrin(name,8,2)是截取的月份字符(格式为:01、02、...12)
month1、month2是在界面组合框选中有起始和终止月份,是字符型,需转成int16型。
但我这样写,有错误提示:
未处理的“System.InvalidCastException”类型的异常出现在 microsoft.visualbasic.dll 中
其他信息:从字符串“select name from dbo.sysobjects ”到类型“Double”的强制转换无效。
这是为什么呢???
请给出正确代码,谢谢了!!!!》