Page 1 of 2

eVB/SQL CE query

PostPosted: Mar 14, 2003 @ 7:24am
by Mike Wagstaff

PostPosted: Mar 14, 2003 @ 9:18am
by refractor

PostPosted: Mar 14, 2003 @ 9:22am
by refractor

PostPosted: Mar 14, 2003 @ 8:31pm
by Mike Wagstaff

PostPosted: Mar 14, 2003 @ 8:55pm
by refractor

PostPosted: Mar 14, 2003 @ 9:17pm
by Mike Wagstaff

PostPosted: Mar 14, 2003 @ 9:37pm
by refractor

PostPosted: Mar 14, 2003 @ 9:53pm
by Presto
"SELECT * FROM Contacts_db WHERE Contact_Name LIKE 'a%';" That should work no problem. I use MySQL on my website.

If it were an Oracle database, you'd need to use: "SELECT * FROM Contacts_db WHERE LOWER(Contact_Name) LIKE 'a%';" because it's case sensitive. MySQL isn't.

PostPosted: Mar 14, 2003 @ 10:14pm
by Mike Wagstaff
Here's the SQL statement used to create the table...

CREATE table D9_contacts (Contact_name text, Home_number text, Home2_number text, Work_number text, Work2_number text, Mobile_number text, Assistant_number text)

Here's the actual eVB code used to query the database (assume that a connection has already been successfully established):

' Define necessary variables
Dim rs As ADOCE.Recordset
Dim Query_string As String

' Set SQL query
Query_string = "Select * from D9_contacts where LEFT(Contact_name,1) in ('m', 'M')"

' Query database
Set rs = CreateObject("ADOCE.Recordset.3.0")
rs.Open Query_string, conn, adOpenForwardOnly, adLockReadOnly

' <Do something useful with query results here...>

rs.Close
Set rs = Nothing


As the code above stands, I would get an "Invalid column ID" error message because of the Query_string. Thanks once again for your help, and if you need to see more code, give me a shout!

PostPosted: Mar 14, 2003 @ 10:19pm
by Mike Wagstaff

PostPosted: Mar 14, 2003 @ 10:30pm
by Presto

PostPosted: Mar 14, 2003 @ 10:30pm
by Mike Wagstaff
Incidentally, if anyone knows of any way that I can include regular expressions using ADOCE, that would solve all my problems... ;)

To try and clarify matters slightly, this code is part of a replacement dialler app for Phone Edition devices intended to imitate the name-finding system available on the SPV.

As you enter a number, the system looks at the letters associated with the keys you have pressed and works out what name you might be trying to type (similar to the text input system, T9). For example, if I wanted to find a contact called Mike, I would hit the following keys...

- 6 (m, n, o)
- 4 (g, h, i)
- 5 (j, k, l)
- 3 (d, e, f)

PostPosted: Mar 14, 2003 @ 10:36pm
by Mike Wagstaff

PostPosted: Mar 14, 2003 @ 10:43pm
by Presto

PostPosted: Mar 14, 2003 @ 11:11pm
by Mike Wagstaff