This site is no longer active and is available for archival purposes only. Registration and login is disabled.

eVB/SQL CE query


eVB/SQL CE query

Postby Mike Wagstaff » Mar 14, 2003 @ 7:24am

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby refractor » Mar 14, 2003 @ 9:18am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby refractor » Mar 14, 2003 @ 9:22am

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Mike Wagstaff » Mar 14, 2003 @ 8:31pm

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby refractor » Mar 14, 2003 @ 8:55pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Mike Wagstaff » Mar 14, 2003 @ 9:17pm

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby refractor » Mar 14, 2003 @ 9:37pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby Presto » Mar 14, 2003 @ 9:53pm

"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.
User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby Mike Wagstaff » Mar 14, 2003 @ 10:14pm

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!
Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby Mike Wagstaff » Mar 14, 2003 @ 10:19pm

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby Presto » Mar 14, 2003 @ 10:30pm

User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby Mike Wagstaff » Mar 14, 2003 @ 10:30pm

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)
Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby Mike Wagstaff » Mar 14, 2003 @ 10:36pm

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Postby Presto » Mar 14, 2003 @ 10:43pm

User avatar
Presto
pm Insider
 
Posts: 763
Joined: Jan 20, 2003 @ 5:51am
Location: Kalesian Archipelago


Postby Mike Wagstaff » Mar 14, 2003 @ 11:11pm

Mike Wagstaff
- For Gamers on the Go...

User avatar
Mike Wagstaff
pm Insider
 
Posts: 486
Joined: Mar 11, 2001 @ 7:43pm
Location: London, UK


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum