Dynamic listboxes from remote .DBF using ADO/RDS 
Author Message
 Dynamic listboxes from remote .DBF using ADO/RDS

Help! I'm drowning in a universe of over-complex MSDN
and web docs surrounding this simple problem.

Can anyone show me some pared-down, working, drop dead
simple code for this?

I've seen some semi-relevant database-to-picklist
examples on the web, but they are obscure because of
their needless complexity and bells and whistles.

I'm about intermediate level with ASP and ADO, still
trying to grasp RDS.

=========
SCENARIO
=========
. Using IE5 from client machine \\mach01.

. ASP scripts reside on http://mach02

. The FoxPro file I want to query is at \\mach02\c\tmp\sw3.dbf
  It is from the ACT sales lead app.  Size is from 6 to 20M.
  Looks like this (didn't design it):

Company  Name
-------  -------
 XEROX   WILL
 XEROX   HECTOR
 ACME    PETE
 ACME    FRED
 ACME    SAM
 AJAX    BILL
 AJAX    ZACK

. MyForm looks like this:

  CompanyList[_________][V]    NameList[_________][V]

======
NEEDS
======
1. Fill an HTML listbox MyForm.CompanyList with the
   Company field from sw3.dbf
   (Done. Works ok, but SLOW)

<!-- Triggered with <body onLoad="InitCompanyList()">  -->
<script language=VBScript>
Sub InitCompanyList
  set rs = createobject("ADODB.Recordset")
  sql = "select Company=rtrim(Company) from sw3 order by Company distinct"
  cnStr = _
    "SourceType=DBF;" & _
    "SourceDB=\\mach02\c\tmp;" & _
    "Driver={Microsoft Visual FoxPro Driver}"
  rs.Open sql, cnStr
  do while not rs.eof
    Company   = rs("Company")
    set opt   = document.createElement("option")
    opt.Text  = Company
    opt.Value = Company
    MyForm.Company.add( opt )
    rs.MoveNext
  loop
  rs.close
End Sub
</script>

2. When user makes CompanyList selection, fill
   MyForm.NameList with the Name field from sw3.dbf,
   where each Name belongs to the Company just selected.

   sqlStr = "select Name from sw3 where rtrim(Company) = '" & _
     MyForm.CompanyList.Value & "' order by Name"

MISC POINTS
------------
. Is there a way to use the index files associated
  with sw3.dbf to speed up the query?  The data is
  is from the ACT sales leads app.

. The NameList must be cleared every time the CompanyList
  selection changes, before it is filled with new values,
  but I haven't found a way to clear a <select> list in
  VBScript.

This simple problem cannot possibly be as difficult with
ADO/RDS as it seems is it?

Thanks in advance, Steve



Wed, 17 Jul 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Dynamic listboxes from remote .DBF using ADO/RDS

2. RDS 2.5 - How to use RDS to get and maintain data on a Remote Server

3. Problem accessing remote DLL using RDS and DCOM

4. How to access to .dbf files using ADO ?

5. dynamic listbox (remote data service)

6. VB6 accessing Fox2.6 tables using ADO/RDS

7. Using ADO to open DBF in VB

8. Updating DBF file Using ADO

9. using .dbf by ADO qustions...

10. Using ADO to access DBF files

11. insert a record into Foxpro DBF File it using ADO

12. Error Trapping in ADO using a Foxpro dbf as a data source

 

 
Powered by phpBB® Forum Software