OleDb: Select

albertkhor

Well-known member
Joined
Jan 12, 2006
Messages
150
Programming Experience
Beginner
SELECT MobilePhone FROM tablePhone WHERE (REPLACE(Mobile_Tel1, '+', '')

why this statement cannot work in Microsoft.Jet.OleDb.4.0?
how to use replace in oledb?
 
it is fully supported by Access (at least MSaccess 2003) but i am not sure that it is correctly implemented in your statement.

The syntax for the Replace function is:
VB.NET:
Replace ( string1, find, replacement, [start, [count, [compare]]] ) [COLOR=green]'last three arguments are optional[/COLOR]

and it suppose to be used as it follows (actually it makes more sense if you do something like this):

VB.NET:
SELECT MobilePhone FROM tablePhone WHERE Mobile_Tel1=REPLACE(Mobile_Tel1, '+', '')

HTH
Regards ;)
 
kulrom said:
it is fully supported by Access (at least MSaccess 2003) but i am not sure that it is correctly implemented in your statement.

The syntax for the Replace function is:
VB.NET:
Replace ( string1, find, replacement, [start, [count, [compare]]] ) [COLOR=green]'last three arguments are optional[/COLOR]

and it suppose to be used as it follows (actually it makes more sense if you do something like this):

VB.NET:
SELECT MobilePhone FROM tablePhone WHERE Mobile_Tel1=REPLACE(Mobile_Tel1, '+', '')

HTH
Regards ;)

Below is my code but it cannot work, can you help me check what i did wrong?

VB.NET:
SQL = "SELECT * FROM Contact [SIZE=2]WHERE Mobile_Tel1=(REPLACE(REPLACE(REPLACE(Mobile_Tel1, '+', ''), '-', ''), ' ', '') LIKE '%" & txtphone.Text & "%'"
[/SIZE]
 
Back
Top