by 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...