vb.NET check if returned value is a number

Posted on 2012-09-19
Last Modified: 2012-09-19
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
Question by:prowebinteractiveinc
    LVL 25

    Expert Comment

    by:Luis Pérez
    You can declare your return variable As Object, do your call and check with IsNumeric the value of your object variable.

    Hope that helps.

    Author Comment

    sample code for the isNaN pls
    LVL 12

    Accepted Solution

    You can evaluate the returned value with the isNumeric() function.
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now