|
-
Aug 9th, 1999, 10:56 PM
#1
Thread Starter
Hyperactive Member
I have a problem using this line:
Code:
Dim cn as rdoConnection
Dim rs as rdoResultset
Dim SQL as string
Cn.Connect = "Database=d:\code\tablas;" & _
"Driver={MERANT 3.50 32-BIT FoxPro 3.0 Database (*.dbc)}"
SQL = "SELECT * FROM contra WHERE centro LIKE '245*25530'"
Set rs=cn.OpenResultset(SQL, rdOpenKeyset, rdConcurValues)
And the rs.RowCount is equal to ZERO! And if I change the 'SQL = ...' line as follows:
Code:
SQL = "SELECT * FROM contra WHERE centro LIKE '2452533425530'"
The rs.rowCount is equal to 8.
Why the LIKE clause is not working with the comodin (*)?
I'm using the RDO object and a MERANT ODBC dirvers (DirectData Connect ODBC 3.50 for Windows 9x-NT).
I'll thank every help.
Ulises
[This message has been edited by Tonatiuh (edited 08-10-1999).]
-
Aug 10th, 1999, 12:09 AM
#2
New Member
Hi,
I'm not completely sure, but this might be the solution:
In general, when searching for a record in a field with a "string" data type you put the string being searched for between single quotation marks. Now however it's likely (for you're using numbers) that the field being searched doesn't contain data of the data type "string", but instead of a data type like "number" or "integer" or something like that. In general you aren't allowed to use the single quotationmarks then. Therefore I would suggest to remove the single quotation marks. (... LIKE 245*5530)This might however result in an unment calculation: 245*5530 = 1354850. That's surely not the purpose of your SQL. Therefore (assuming the field being searched is of a "string" data type) you perhaps have to change your field's data type into "string". Then there's probably no risk of computing 245 times 5530 resulting in 1354850.
I hope I've helped you out now...
(Sorry for my bad English, it's not my native language, you see)
-
Aug 10th, 1999, 05:24 PM
#3
Lively Member
Is this in Access or a different database?
Try using % as it is typically equivalent to * in ANSI SQL.
-
Aug 11th, 1999, 12:50 AM
#4
New Member
Try this:
Dim number1
Dim number2
number1 = 245
number2 = 25530
SQL= "Select * from contra where centro like '" & number1 & "*" & number2 & "';"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|