Link to home
Start Free TrialLog in
Avatar of prowebinteractiveinc
prowebinteractiveinc

asked on

vb.NET check if returned value is a number

I have created a log file in mySQL for loggin users that connect to my db
the function that writes to the db is suppose to return the mysql_insert_id()

if the record fails it sends text or nothing, I want to make sure that the logging into the system doesnt work if the vb.NET app doesnt receive the mysql_insert_id()

I was thinking of isNaN but Im not quite sure how to use this function

please help
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

You can declare your return variable As Object, do your call and check with IsNumeric the value of your object variable.

Hope that helps.
Avatar of prowebinteractiveinc
prowebinteractiveinc

ASKER

sample code for the isNaN pls
ASKER CERTIFIED SOLUTION
Avatar of Jared_S
Jared_S

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should be able to use a nullable type. For example:

Dim id As Nullable(Of Integer)

id = DirectCast(command.ExecuteScalar(), Nullable(Of Integer))

If id.HasValue Then
    ' The id was returned
End If

Open in new window