473,473 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

comparing array with a data base value

3 New Member
i want to compare the array value with the data base value

how can i do this

please help

Pramod mujumdar
Aug 13 '07 #1
3 1229
jhardman
3,406 Recognized Expert Specialist
Pramod

pretty easily...
Expand|Select|Wrap|Line Numbers
  1. if names("jackson") = rs("names") then
What part is giving you trouble?

Jared
Aug 14 '07 #2
getteddy
3 New Member
I am not comparing the normal value with the database. Im comparing the Array value. The code which you suggested was for the normal value.
Oct 12 '07 #3
markrawlingson
346 Recognized Expert Contributor
I think what you are trying to do is see if a value coming from your database can be found within an array.

So if you had a field in the database called Name, we'll say it has a value of "Mark" - (don't know why that name popped into my head :P)

You want to check an array of values to see if "Mark" can be found within that array, is that accurate?

If so, I wrote a function for this task. The only problem with it is that it does not account for multi-dimensional arrays, but i don't suppose you'll need that in this case anyway...

Expand|Select|Wrap|Line Numbers
  1. <%
  2.     Function IsLegitimate(aTemp,sTerm)
  3.         For i = 0 To UBound(aTemp)
  4.             If InStr(aTemp(i), sTerm) > 0 Then
  5.                 IsLegitimate = True
  6.                 Exit For
  7.             Else
  8.                 IsLegitimate = False
  9.             End If
  10.         Next
  11.     End Function
  12.  
  13.    aMyArray = Split("Mark Joe John Sam Charlie Patrick Dick Don Dawn")
  14.  
  15.    If IsLegitimate(aMyArray,rs("DataField")) Then
  16.        Response.Write "Dude... I totally just found the name in the array."
  17.    Else
  18.       Response.Write "Aw shucks, name's not found in the array. What ever shall we do?"
  19.    End If
  20.  
  21. %>
  22.  
Pretty self explanitory, will loop through an array attempting to find whatever value rs("DataField") contains, and return a boolean value of true or false depending on whether the value of rs("DataField") is found within the array or not.

HTH!
Sincerely,
Mark
Oct 12 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Reed Law | last post by:
I have the exact same data in two arrays, but only the array created like so will work: $spaw_imglibs = array( array( 'value' => '/youth/pics/Member pics/', 'text' => 'Member pics', ),...
11
by: Peter | last post by:
Hi how can I compare two byte arrays in VB.NET Thank Peter
3
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C...
19
by: Dennis | last post by:
I have a public variable in a class of type color declared as follows: public mycolor as color = color.Empty I want to check to see if the user has specified a color like; if mycolor =...
5
by: ma740988 | last post by:
There's a need for me to move around at specified offsets within memory. As as a result - long story short - unsigned char* is the type of choice. At issue: Consider the case ( test code ) where...
2
by: Pugi! | last post by:
hi, I am using this code for checking wether a value (form input) is an integer and wether it is smaller than a given maximum and greater then a given minimum value: function...
25
by: J Caesar | last post by:
In C you can compare two pointers, p<q, as long as they come from the same array or the same malloc()ated block. Otherwise you can't. What I'd like to do is write a function int comparable(void...
2
by: getteddy | last post by:
hi i am working on array , i am facing a problem in comparing data base element with array element if not (objrs("namephase")=("despArray(ctr,0)+despArray(ctr,3)")) then or If...
2
by: TamaThps | last post by:
I have to write a program that takes the lines of code from a .cpp as a string into an array. Then I need to compute the ratio of total lines of code to the number of comment lines, and ratio of...
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
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.