|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SELECT EMP.ID WHERE EMP.ID LIKE 'RO*' doesn't work
<i><b>Originally posted by : Armando Corazon (a_corazon@hotmail.com)</b></i><br />Does anybody knows why I can't retrieve any record from a table usin the Like filter in an SQL Statement??<br /><br /> <br />For example:<br /><br />Set rs = Server.CreateObject("ADODB.Recordset")<br />rs.CursorLocation= 3 ' adUseClient<br />conn.Open "DSN=BOTAO;"<br />strSql = "SELECT EMP.ID " & _<br /> "FROM PARTES " & _<br /> "WHERE EMPID LIKE '" & request("id") & "';"<br />rs.Open strSql, conn ', adOpenStatic<br /><br />Thanks <br /><br />Armando<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Martin Burford (Not Submitted)</b></i><br />Yup, I can.<br /><br />The problem DOES NOT lie in the LIKE command in the following example. You do not have the correct line carriage returns on the SQL statement.<br /><br />It should work with the following syntax:-<br /><br />strSql="SELECT EMP.ID"& _<br />strSql=strSql &"FROM PARTES"& _<br />strSql=strSql &"WHERE EMPID LIKE"&_<br />strSql=strSql &"'"& Request("id")"'";<br /><br />Regards<br />Martin<br />
|
|
#3
|
|||
|
|||
|
Dear User,
At the very begining i am assuming that your EMPID is Integer datatype. If so then LIKE operator will never work. LIKE operator works only with character strings matching a specific pattern. If the EMPID is a character datatype then you must user '%' instead like '*' Your query stands like -- Query = "SELECT EMP.ID FROM PARTES " Query = Query + "WHERE EMP.ID LIKE '" & request("id") & "%'"; |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SELECT EMP.ID WHERE EMP.ID LIKE 'RO*' doesn't work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|