473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to find if a variable is an INT or a CHAR

i create a table on the fly using sql,

using syntax like :-

commitmentsstring = commitmentsstring & "<tr><td><FONT face=""Arial""
size=""2"">" & ds.Tables(0).Rows(counter)(2) & "</FONT></td>" & "<td><FONT
face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(3) & "</FONT></td>"
& "<td><FONT face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(4) &
"</FONT></td>" & "<td><FONT face=""Arial"" size=""2"">" &
ds.Tables(0).Rows(counter)(5) & "</FONT></td>" & "<td><FONT face=""Arial""
size=""2"">" & ds.Tables(0).Rows(counter)(6) & "</FONT></td>" & "<td><FONT
face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(7) &
"</FONT></td></tr>"

with a for while loop,

i do additions for particular columns like this :-

If ds.Tables(0).Rows(counter)(2) = "1" And ds.Tables(0).Rows(counter)(6) >
"" Then
totalbalance1 = totalbalance1 + Int(ds.Tables(0).Rows(counter)(6))
End If

i need to check to see if ds.Tables(0).Rows(counter)(6) is a INT or a CHAR
eg

If ds.Tables(0).Rows(counter)(2) = "1" And ds.Tables(0).Rows(counter)(6) >
"" And ds.Tables(0).Rows(counter)(6) "isn't a char" Then
totalbalance1 = totalbalance1 + Int(ds.Tables(0).Rows(counter)(6))

can this be done easily ?

cheers

mark
Nov 19 '05 #1
3 1274
"mark" <ma**@remove.com> wrote in message
news:11****************@damia.uk.clara.net...
can this be done easily ?


Since you're using VB.NET, why not just use IsNumeric(...)?
Nov 19 '05 #2
Hi Mark,

You can use TypeOf...Is operator to determine object type, e.g.

If TypeOf obj Is Integer Then
intValue = Convert.ToInt32(obj)
End If

HTH

Elton Wang
el********@hotmail.com
"mark" wrote:
i create a table on the fly using sql,

using syntax like :-

commitmentsstring = commitmentsstring & "<tr><td><FONT face=""Arial""
size=""2"">" & ds.Tables(0).Rows(counter)(2) & "</FONT></td>" & "<td><FONT
face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(3) & "</FONT></td>"
& "<td><FONT face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(4) &
"</FONT></td>" & "<td><FONT face=""Arial"" size=""2"">" &
ds.Tables(0).Rows(counter)(5) & "</FONT></td>" & "<td><FONT face=""Arial""
size=""2"">" & ds.Tables(0).Rows(counter)(6) & "</FONT></td>" & "<td><FONT
face=""Arial"" size=""2"">" & ds.Tables(0).Rows(counter)(7) &
"</FONT></td></tr>"

with a for while loop,

i do additions for particular columns like this :-

If ds.Tables(0).Rows(counter)(2) = "1" And ds.Tables(0).Rows(counter)(6) >
"" Then
totalbalance1 = totalbalance1 + Int(ds.Tables(0).Rows(counter)(6))
End If

i need to check to see if ds.Tables(0).Rows(counter)(6) is a INT or a CHAR
eg

If ds.Tables(0).Rows(counter)(2) = "1" And ds.Tables(0).Rows(counter)(6) >
"" And ds.Tables(0).Rows(counter)(6) "isn't a char" Then
totalbalance1 = totalbalance1 + Int(ds.Tables(0).Rows(counter)(6))

can this be done easily ?

cheers

mark

Nov 19 '05 #3

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:uN**************@tk2msftngp13.phx.gbl...
"mark" <ma**@remove.com> wrote in message
news:11****************@damia.uk.clara.net...
can this be done easily ?


Since you're using VB.NET, why not just use IsNumeric(...)?

thats exactly what i was looking for nice n easy too! works a treat

mark
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis Westermann | last post by:
I have the following problem XML-File: <SEARCH> <TAG>'x' or 'y'</TAG> </SEARCH> <CHARLIST> <CHAR>a</CHAR> <CHAR>x</CHAR>
3
by: Bryan Parkoff | last post by:
.....I try to reduce un-necessary temporal variables so it can be optimized for best performance. I try to assign only one register storage so two variables can access to only one register storage...
8
by: Groups User | last post by:
C allows type casting in which a variable is converted from one type to another. Does C (whatever standard) allow the type of a variable to change, within a statement, avoiding the conversion?...
5
by: nmtoan | last post by:
Hi, I could not find any answer to this simple question of mine. Suppose I have to write a program, the main parts of it are as follows: #include <blahblah.h> struct {
1
by: Shawn | last post by:
As if it won't be clear enough from my code, I'm pretty new to C programming. This code is being compiled with an ANSI-C compatible compiler for a microcontroller. That part, I believe, will be...
5
by: chellappa | last post by:
Hi All, How to find the data type of the variable ? is there any libaray function avaiable? Because i want create generic data type of some operation . Thanks All By Chellappa
29
by: Ajay | last post by:
Hi all,Could anybody tell me the most efficient method to find a substr in a string.
36
by: Rahul K | last post by:
Hello all Suppose I am given a datatype say X in C. How can i find its size without declaring a variable or pointer variable of that type, and of course without using sizeof operator.
6
by: vaidehikedlaya | last post by:
Hello, I am using gmp.h library. I am trying to put mpz_t variable into char buffer and back. I came across mpz_import/mpz_export to suffice this purpose. But, I am not very clear about using...
24
by: arnuld | last post by:
I want to create a new array of the same size of an array already available: #include <stdio.h> #include <string.h> int main(void) { char arrc = "URI";
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.