473,698 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

numeric value and string

okay.. this should be long..

I made up a table in database with access consists of columns with text type. Some of them I put in data with numeric value and some of them I put in "Unlimited" as the value.

Then, I allowed people to insert data but only with conditions. They can insert data if the value they are trying to insert is smaller than the one in the database. For "unlimited" value, they can insert any value.

My problem is.... if the limited value in the database is 35, we cant insert data of 40 but we can insert data of 100. It seems that the code only takes the first number to be compared to the value in the database.

Can anyone help me to overcome this?

here''s part of my code

If (diff = 0) OR (diff = 1) Then
If (maxunit1 < strnoofunit) OR (maxdoc1 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
ElseIf (diff = 2) Then
If (maxunit2 < strnoofunit) OR (maxdoc2 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
ElseIf (diff = 3) Then
If (maxunit3 < strnoofunit) OR (maxdoc3 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End if
ElseIf (diff = 4) Then
If (maxunit4 < strnoofunit) OR (maxdoc4 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
ElseIf (diff = 5) Then
If (maxunit5 < strnoofunit) OR (maxdoc5 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
Else
If (maxunit6 < strnoofunit) OR (maxdoc6 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
End If

'' -------------------------------------------------------------------------
'' finish
'' -------------------------------------------------------------------------
rs.Open "SELECT * FROM timesheet", conn, 3, 3
''Add a record
rs.AddNew
''Put username and password in record
rs("memberid") = Session("member id")
rs("reference_n o") = strrefno
rs("entry_date" ) = date()
rs("lspid") = Session("lspid" )
rs("solicitorid ") = Session("solid" )
rs("code") = strcode
rs("no_of_unit" ) = strnoofunit
rs("no_of_docum ent") = strnoofdoc
rs("note_legalm atter")= strlegalmatter
rs("note_entitl ement")= strentitle

''Save record
rs.Update

Thanks guys

-----------------------------
This message is posted by http://asp.forumszone.com

Jul 22 '05 #1
2 4143
Don't store numeric data as text.

I'm not sure what your code is supposed to be doing, but if you're doing the
comparison in your code (as opposed to in a SQL [non]query), you can CInt
the values to compare them. You can also do that in the query.

iCurrentValue = yourRecordset.F ields.Item("you rColumn").Value
If iCurrentValue <> "Unlimited" Then
If CInt(iNewValue) > CInt(iCurrentVa lue) Then
''your code
End If
End If

Ray at work

"Iona" <io**********@h otmail.com> wrote in message
news:87******** *****@asp.forum szone.com...
okay.. this should be long..

I made up a table in database with access consists of columns with text type. Some of them I put in data with numeric value and some of them I put
in "Unlimited" as the value.
Then, I allowed people to insert data but only with conditions. They can insert data if the value they are trying to insert is smaller than the one
in the database. For "unlimited" value, they can insert any value.
My problem is.... if the limited value in the database is 35, we cant insert data of 40 but we can insert data of 100. It seems that the code only
takes the first number to be compared to the value in the database.
Can anyone help me to overcome this?

here''s part of my code

If (diff = 0) OR (diff = 1) Then
If (maxunit1 < strnoofunit) OR (maxdoc1 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer ("maxunit2.asp" )
End If
ElseIf (diff = 2) Then
If (maxunit2 < strnoofunit) OR (maxdoc2 < strnoofdoc) Then
rs2.close
conn.close

Jul 22 '05 #2

"Iona" <io**********@h otmail.com> wrote in message
news:87******** *****@asp.forum szone.com...
okay.. this should be long..

I made up a table in database with access consists of columns with text type. Some of them I put in data with numeric value and some of them I put
in "Unlimited" as the value.
Then, I allowed people to insert data but only with conditions. They can insert data if the value they are trying to insert is smaller than the one
in the database. For "unlimited" value, they can insert any value.
My problem is.... if the limited value in the database is 35, we cant insert data of 40 but we can insert data of 100. It seems that the code only
takes the first number to be compared to the value in the database.
Can anyone help me to overcome this?


If your data is brought in as a string, you need to cast it to a number to
be able to compare it numerically.
when you compare strings, it looks at the characters - not the actual
numbers.
f'rinstance:
If isNumeric(strVa riableName) then
dim intTemp as Double= System.Convert. ToDouble(strVar iableName)
etc
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.807 / Virus Database: 549 - Release Date: 12/8/2004
Jul 22 '05 #3

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

Similar topics

5
13850
by: ief | last post by:
hi all, i'm trying to check the length of a numeric value in a string. this is what i need to do: I have a string "Mystring (253)" and a string "SecondString (31548745754)" Now i have to check if the string contains more than 3 numeric characters because i must only process the ones with more than 3.
11
4565
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing opinion of how I want to handle the 'user experience' in the application I'm creating. While I know I could allow the user to enter in number and alpha text - in a text box - and then tell them when the execuate a command "This is not numeric data", I...
6
9218
by: M.A. Oude Kotte | last post by:
Hi All, I hope this is the correct mailing list for this question. But neither postgresql.org nor google could help me out on this subject. I did find one disturbing topic on the mailing list archives (http://archives.postgresql.org/pgsql-admin/2000-05/msg00032.php), but since it was quite old I'm posting my question anyway. I'm writing a generic database layer that should support a fixed number of generic numeric types on a number of...
20
3706
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If MyVariant = 2 Then MsgBox "MyVariant also equals the value 2" 160 If MyVariant = "" Then HowManyCopies = 1 170 If Not IsNumeric(MyVariant) Then HowManyCopies = 1 MsgBox "OK. HowManyCopies has a value of " & CStr(HowManyCopies) 180 For i =...
4
2263
by: Doug Gray | last post by:
Folks, I am looking for a fast but most importantly a bullet proof method to pass and NMEA data stream (GPS output) ascii numeric strings. The best I can offer is: def fint(a): try: return int(float(a)) except: return 0 The reason for this is the quality of the data from the huge variety of
13
14977
by: nishit.gupta | last post by:
Is their any fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" Thnx
14
2925
by: nishit.gupta | last post by:
Is their any single fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" , It can also contain zero
6
2915
by: frohlinger | last post by:
Hi, I need to perform some numeric calculations on a numeric float value, that is received as wstring. I would like to perform a check before converting the wstring to float, checking that indeed the wstring contains a numeric value. This is the actual conversion: double fValue = _wtof(strValue.c_str()); if strValue contains some characters (e.g.: 'aaa'), _wtof returns 0, therefore I do not really know that the input was initially...
5
5521
by: Mike | last post by:
I use MS SQL EXPRESS DB VS 2005, c# Win Application I have problem "The string is non-numeric" with formula CDbl({pr_DajPonudu;1.KolicinskiPopust})/100 * {@NajamProstora}
9
8240
by: engteng | last post by:
How do I convert string to numeric in VB.NET 2003 ? Example convert P50001 to 50001 or 50001P to 50001 but if P is in middle then not convert. Regards, Tee
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9026
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.