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!

ODBC problem

Status
Not open for further replies.

yagnik3128

Programmer
Jun 14, 2001
64
IN
I am developing network applications.

I am using ODBC for MS Access database & ADO.

My coding sequence is

dim Sql as string
dim RsSql as new adodb.recordset

sql = "Select * from Group Where GroupCode like '" & txtgroup & "%' order by GroupDescr"

rssql.open sql,MyConn, adopenkeyset, adlockoptimistic,

But the query is very slow.

If I use provider 4.0 & * instead of % in a select statement, it is very fast.

Is there any solution to use % & ADO & DSN (ODBC) very fast.
 
I'm not sure but you can try putting another % sign in your query.

sql = "Select * from Group Where GroupCode like '%" & txtgroup & "%'"

The % sign tells SQL that the statement is not a complete word and to look for matching letters. If the % sign is left off of the front (which may be what you need, sorry if it is) then SQL thinks that you are looking for a word starting with "txtgroup" with the ending of the word not complete.

Example: searching for Betty

'%tty' tells SQL that the statement ends with "tty"

'Bet%' tells SQL that the statement starts with "Bet"

'%ett%' tells SQL that the satement has "ett" in the middle.

If you know the word is equal to what you're lookin for then you can state:

sql = "Select * from Group Where GroupCode ='" & txtgroup & "'"

Hope this is what you were looking for.

Every day above ground is a GOOD DAY!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top