?
Solved

vb.NET check if returned value is a number

Posted on 2012-09-19
4
Medium Priority
?
397 Views
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
0
Comment
Question by:prowebinteractiveinc
4 Comments
 
LVL 25

Expert Comment

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

Hope that helps.
0
 

Author Comment

by:prowebinteractiveinc
ID: 38413905
sample code for the isNaN pls
0
 
LVL 12

Accepted Solution

by:
Jared_S earned 2000 total points
ID: 38413917
You can evaluate the returned value with the isNumeric() function.

http://msdn.microsoft.com/en-us/library/6cd3f6w1(v=vs.71).aspx
0
 
LVL 75

Expert Comment

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

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

862 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