Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Find... What am I doing wrong..

Status
Not open for further replies.

Kinl

Programmer
Mar 19, 2001
168
US
Hey guys,

Sorry for the numerous posts today, but I cant find to solve my problem, and all my books say I'm doing it the right way.

Here's what I have:
rs.Find ("c_id = '" & ls_c_id & "'"),1,1
IF rs.EOF THEN
'Nothing happens!
'No duplicates found
ELSE
MSG = &quot;<b>You can only enter once!</b>&quot;

END IF

If there is a matching record in there, it wont find it. What am I doing wrong? Thanx
Donn
 
is c_id a text field?

if it isn't, remove the ' marks

ex:
rs.Find (&quot;c_id = &quot; & ls_c_id),1,1

hth
leo
leo
 
c_id is a char field so thats why i have to use the tick marks. I was reading somewhere that the # symbol would help. Is this true?
 
Is the database field char() or varchar()? Hopefully it's varchar(), otherwise you're comparing 'XYZ ' = 'XYZ'. Brian J. Alves
Email: brian.alves@worldnet.att.net
VB / ASP / Crystal / SQLServer
 
I am curious why did you abandon the stored proc route outlined in the earlier thread? it is certainly the way to go.


BUT, if that is not your cup of tea the I would suggest abandoning the .find command and writing your own query something like this



set rs=server.createobject(adodb.recordset)
ssql=&quot;select * from tablename where c_id like'%&quot;& ls_c_id & &quot;%'&quot;
rs.open ssql,yourconnectionstring

if rs.eof & rs.bof then
'success
else
response.write &quot;that is a duplicate&quot;
end if



this is assuming that any or all of the param (ls_c_id)is contained in the column (c_id)


hope that helps


Bassguy
 
I'm just out of time right now. I dont have time to research it, and debug it. I figured out my problem and I appreciate all the help from everyone!!! The stored Proc is definately something i'm going to use in the future!!

Thanx again!

Donn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top