在VB.NET中无法将nvarchar转换为long [英] Cannot conver type nvarchar to long in VB.NET

查看:157
本文介绍了在VB.NET中无法将nvarchar转换为long的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是在vb.net中开发的。我使用过Msh FlexGrid,我想检查网格单元格中是否有任何值。



我尝试过:



我的代码是

My project is developed in vb.net.I've used Msh FlexGrid and i want to check If Grid Cell Has any value in grid.

What I have tried:

My code is

<pre>  
With GridMed
          For intRow = 1 To .Rows - 1
                    If Not .TextMatrix(intRow, .GetColIndex("HpName")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("DoctorName")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("RegNo")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("ID1")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("Id2")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("Fitness")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("CertifiedDate")) <> "" Or Not .TextMatrix(intRow, .GetColIndex("Status")) Then
                        Exit For
                    End If
End with
                   
It shows Following error 

Conversion from string "hjkhj" to type 'Long' is not valid.

推荐答案

查看错误消息:

Look at the error message:
Conversion from string "hjkhj" to type 'Long' is not valid.

非常清楚,绝对正确。

您期望从字符串hjkhj获得什么样的数字?系统告诉你这不是一个数字,我不能用它做任何事情。



您需要检查您的数据源,并找出答案为什么你期望成为一个数值是一个看起来像懒惰打字的字符串...



我们不能为你做这个。

It's pretty clear, and absolutely right.
What kind of number do you expect to get from the string "hjkhj"? The system is telling you "this isn't a number, I can't do anything with it".

You need to check your data source, and find out why what you expect to be a numeric value is a string that looks like lazy typing...

We can't do that for you.


这篇关于在VB.NET中无法将nvarchar转换为long的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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