If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Using wildcards to search number field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-04, 11:00
katlees katlees is offline
Registered User
 
Join Date: Jul 2004
Posts: 3
Exclamation Using wildcards to search number field

I have a database. I want to have a form where the user puts in an area code and it uses that value to search the PHONE field. How do I use the wildcard of * with the value from the from?
This is the code I have tried so far..
<form name="form" method="post" action="">
<p>

Record#:
<input type="text" name="ID">

<input type="submit" name="Submit" value="Delete Record">
</p>
</form>
<%
Dim Conn, RS, PMID
PMID = Request.Form("ID")
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
Conn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("zip.mdb"))

sql = "Select * from Dealer WHERE Phone Like" & PMID'*"
Conn.execute(sql)
Conn.Close



%>
</body>
Reply With Quote
  #2 (permalink)  
Old 12-04-04, 21:34
White Knight White Knight is offline
Registered User
 
Join Date: Dec 2004
Location: York, PA
Posts: 95
You just missed a bit
sql = "Select * from Dealer WHERE Phone Like '" & PMID & "*'"
Reply With Quote
  #3 (permalink)  
Old 12-04-04, 21:35
White Knight White Knight is offline
Registered User
 
Join Date: Dec 2004
Location: York, PA
Posts: 95
Ohhh and I think Jet means you have to use % instead of *
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On